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; // * ( (b->y - a->y) > 0 ? 1 : -1 );
point_t *my = minP(a,b,y);
double cp = (s->x - my->x) ? coeff_ang(my, s) :
HUGE_VAL; // * ( (s->y - my->y) > 0 ? 1 : -1);
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); \