Include points at border in IsPointInRectangle

This commit is contained in:
karl 2020-12-08 11:52:05 +01:00
parent e832407ea0
commit 8041535b51
2 changed files with 7 additions and 7 deletions

View File

@ -8,14 +8,14 @@ the deployed release uses static linkage.
## program arguments ## program arguments
``` ```
-v mode with enabled visualization -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 https://en.wikipedia.org/wiki/Convex_hull_algorithms#Akl%E2%8
-f <filename> read random numbers from file -f <filename> read random numbers from file
-rngcount <count> generates count random float values --rngcount <count> generates count random float values
-rngmode <mode> if generating float values this specifies the mode: --rngmode <mode> if generating float values this specifies the mode:
1. random numbers in screen range 1. random numbers in screen range
2. numbers are ordered as rectangle 2. numbers are ordered as rectangle
3. numbers are ordered as circle around screen center 3. numbers are ordered as circle around screen center
-runs <count> runs performance mode multiple times --runs <count> runs performance mode multiple times
-stepsize <size> time between autosteps; if 0 or not provided -> manual steps --stepsize <size> time between autosteps; if 0 or not provided -> manual steps
``` ```

View File

@ -30,8 +30,8 @@ static bool IsPointInRectangle(const Point& pt, const Point& p1, const Point& p2
float d3 = sign(pt, p3, p4); float d3 = sign(pt, p3, p4);
float d4 = sign(pt, p4, p1); float d4 = sign(pt, p4, p1);
bool has_neg = (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); bool has_pos = (d1 >= 0) || (d2 >= 0) || (d3 >= 0) || (d4 >= 0);
return !(has_neg && has_pos); return !(has_neg && has_pos);
} }