From 8041535b51049f0a12898da55da33e016e4b00d4 Mon Sep 17 00:00:00 2001 From: karl Date: Tue, 8 Dec 2020 11:52:05 +0100 Subject: [PATCH] Include points at border in IsPointInRectangle --- README.md | 10 +++++----- Utility.h | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 4f0e994..88839ed 100644 --- a/README.md +++ b/README.md @@ -8,14 +8,14 @@ the deployed release uses static linkage. ## program arguments ``` -v mode with enabled visualization --akl using Akl-Toussaint heuristic beforehand +--akl using Akl-Toussaint heuristic beforehand https://en.wikipedia.org/wiki/Convex_hull_algorithms#Akl%E2%8 -f read random numbers from file --rngcount generates count random float values --rngmode if generating float values this specifies the mode: +--rngcount generates count random float values +--rngmode if generating float values this specifies the mode: 1. random numbers in screen range 2. numbers are ordered as rectangle 3. numbers are ordered as circle around screen center --runs runs performance mode multiple times --stepsize time between autosteps; if 0 or not provided -> manual steps +--runs runs performance mode multiple times +--stepsize time between autosteps; if 0 or not provided -> manual steps ``` diff --git a/Utility.h b/Utility.h index a48073e..6c65690 100644 --- a/Utility.h +++ b/Utility.h @@ -30,8 +30,8 @@ static bool IsPointInRectangle(const Point& pt, const Point& p1, const Point& p2 float d3 = sign(pt, p3, p4); float d4 = sign(pt, p4, p1); - bool has_neg = (d1 < 0) || (d2 < 0) || (d3 < 0) || (d4 < 0); - bool has_pos = (d1 > 0) || (d2 > 0) || (d3 > 0) || (d4 > 0); + bool has_neg = (d1 <= 0) || (d2 <= 0) || (d3 <= 0) || (d4 <= 0); + bool has_pos = (d1 >= 0) || (d2 >= 0) || (d3 >= 0) || (d4 >= 0); return !(has_neg && has_pos); }