summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dda.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/dda.c b/dda.c
index 55e2e1c..6479c5a 100644
--- a/dda.c
+++ b/dda.c
@@ -87,11 +87,11 @@ dda (test_data_t *testdata)
exit (-1);
}
+ e -= sample_step_y (y) * dxdy;
+ x += sample_step_y (y) * dxdy;
+
if (dxdy >= 0)
{
- e -= sample_step_y (y) * dxdy;
- x += sample_step_y (y) * dxdy;
-
while (e <= 0)
{
double s = sample_step_x_forward (xi);
@@ -102,12 +102,7 @@ dda (test_data_t *testdata)
}
else
{
- double s;
-
- e -= sample_step_y (y) * dxdy;
- x += sample_step_y (y) * dxdy;
-
- s = sample_step_x_backward (xi);
+ double s = sample_step_x_backward (xi);
while (e > s)
{