summaryrefslogtreecommitdiff
path: root/dda.c
diff options
context:
space:
mode:
Diffstat (limited to 'dda.c')
-rw-r--r--dda.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/dda.c b/dda.c
index 9e7db61..91357ee 100644
--- a/dda.c
+++ b/dda.c
@@ -56,13 +56,12 @@ dda (test_data_t *testdata)
double y1 = testdata->segment.y1;
int i = 0;
-
double dxdy = (x1 - x0) / (y1 - y0);
double y = next_sample_y (y0);
+ double x = (y - y0) * dxdy + x0;
while (y < next_sample_y (y1))
{
- double x = (y - y0) * dxdy + x0;
double xi = next_sample_x (x);
if (testdata->points[i++] != xi ||
@@ -72,6 +71,8 @@ dda (test_data_t *testdata)
exit (-1);
}
+ x += sample_step_y (y) * dxdy;
+
y += sample_step_y (y);
}
}