diff --git a/cameo/area.c b/cameo/area.c index 364f4a5..322f892 100644 --- a/cameo/area.c +++ b/cameo/area.c @@ -167,9 +167,8 @@ static int hit_segment(double fx, double fy, double tx, double ty, dx = b->x-a->x; dy = b->y-a->y; - if (enter && dy < 0) - return 0; - if (!enter && dy > 0) + /* -dy becomes the x component of the normal vector */ + if (enter ? dy < 0 : dy > 0) return 0; d = hypot(dx, dy);