summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSøren Sandmann Pedersen <ssp@l3000.localdomain>2010-12-06 03:01:51 -0500
committerSøren Sandmann Pedersen <ssp@l3000.localdomain>2010-12-20 10:48:50 -0500
commitd522edfd970183bcaf2cdce8e1748436f0808aec (patch)
tree46c03fd8ed8836a141575c1a5423dcc08f88b8b9
parentdd1b71a792b8fafdc9b729b7a2de345b07874ef3 (diff)
Delete X variable
-rw-r--r--dda.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/dda.c b/dda.c
index 8e4d79e..f045cd4 100644
--- a/dda.c
+++ b/dda.c
@@ -72,11 +72,9 @@ dda (test_data_t *testdata)
double dy = (y1 - y0);
double dxdy = dx / dy;
double yi = next_sample_y (y0);
- double x = (yi - y0) * dxdy + x0;
double xi = next_sample_x (x0);
- double e = (xi - x0) * dy;
+ double e = (xi - x0) * dy - (yi - y0) * dx;
- e -= (yi - y0) * dx;
if (dx >= 0)
{
while (e <= 0)
@@ -109,7 +107,7 @@ dda (test_data_t *testdata)
if (testdata->points[i++] != xi ||
testdata->points[i++] != yi)
{
- printf ("error %f %f %f\n", x, testdata->points[i - 1], xi);
+ printf ("error %f %f\n", testdata->points[i - 1], xi);
exit (-1);
}