From ebcdfd52ca5a725b35bf6cb7a6903377a5dca899 Mon Sep 17 00:00:00 2001 From: Werner Almesberger Date: Tue, 20 Mar 2012 19:18:08 -0300 Subject: [PATCH] cameo/area.c (hit_segment): clean up entry/exit handling --- cameo/area.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) 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);