diff options
| author | Yidi <noob999noob999@gmail.com> | 2025-02-12 17:12:09 +0100 |
|---|---|---|
| committer | Yidi <noob999noob999@gmail.com> | 2025-02-12 17:12:09 +0100 |
| commit | d91ac762cdb3e4c30cdeaf7a078ae5a8d32ed489 (patch) | |
| tree | efcc2a04353759e6309d7968888921516df3a525 /content | |
| parent | 939e434ae205af10cccb4ce8e4103e9ec3f1e7a1 (diff) | |
fix comment
Diffstat (limited to 'content')
| -rw-r--r-- | content/geometry/polygon.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/content/geometry/polygon.cpp b/content/geometry/polygon.cpp index 064d81f..1332a4a 100644 --- a/content/geometry/polygon.cpp +++ b/content/geometry/polygon.cpp @@ -23,14 +23,13 @@ ll windingNumber(pt p, const vector<pt>& poly) { return res; } -// Testet, ob ein Punkt im Polygon liegt (beliebige Polygone). -// Ändere Zeile 32 falls rand zählt, poly[0] == poly.back() +// check if point is inside polygon (any polygon) bool inside(pt p, const vector<pt>& poly) { bool in = false; for (int i = 0; i + 1 < sz(poly); i++) { pt a = poly[i], b = poly[i + 1]; - if (pointOnSegment(a, b, p)) return false; - if (real(a) > real(b)) swap(a,b); + if (pointOnSegment(a, b, p)) return false; // border counts? + if (real(a) > real(b)) swap(a, b); if (real(a) <= real(p) && real(p) < real(b) && cross(p, a, b) < 0) { in ^= 1; |
