summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dda.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/dda.c b/dda.c
index e6fe822..033be52 100644
--- a/dda.c
+++ b/dda.c
@@ -86,6 +86,7 @@ dda (test_data_t *testdata)
double dy = (y1 - y0);
int yi = next_sample_y (y0);
int xi = next_sample_x (x0);
+ int bottom = next_sample_y (y1);
double e = (sample_to_pos (xi) - x0) * dy - (sample_to_pos (yi) - y0) * dx;
double delta_e_big_x, delta_e_big_y;
double delta_e_small_x, delta_e_small_y;
@@ -95,7 +96,7 @@ dda (test_data_t *testdata)
delta_e_big_y = BIG_STEP_Y * dx;
delta_e_small_y = SMALL_STEP_Y * dx;
- while (yi < next_sample_y (y1))
+ while (yi < bottom)
{
if (dx >= 0)
{
@@ -166,9 +167,7 @@ main ()
{
int i;
for (i = 0; i < sizeof testdata / sizeof testdata[0]; ++i)
- {
dda (&(testdata[i]));
- }
return 0;
}