Anonymous user
Ray-casting algorithm: Difference between revisions
m
→{{header|C}}: removed old-work comments; alignment of \ into define
(+ Tcl) |
m (→{{header|C}}: removed old-work comments; alignment of \ into define) |
||
Line 129:
if ( s->x <= MIN(a->x, b->x) ) return true;
double ca = (a->x != b->x) ? coeff_ang(a,b) :
HUGE_VAL
point_t *my = minP(a,b,y);
double cp = (s->x - my->x) ? coeff_ang(my, s) :
HUGE_VAL
if ( cp >= ca ) return true;
return false;
Line 153:
Testing:
<lang c>#define MAKE_TEST(S) do { \
printf("point (%.5f,%.5f) is ", test_points[i].x, test_points[i].y); \
if ( point_is_inside(&S, &test_points[i]) ) \
printf("INSIDE " #S "\n"); \
else \
printf("OUTSIDE " #S "\n"); \
} while(0);
|