We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f5c8b59 commit d10040eCopy full SHA for d10040e
content/geometry/insidePolygon.h
@@ -16,13 +16,15 @@
16
17
#include "Point.h"
18
#include "onSegment.h"
19
+#include "SegmentDistance.h"
20
21
template<class P>
22
bool inPolygon(vector<P> &p, P a, bool strict = true) {
23
int cnt = 0, n = sz(p);
- rep(i, 0, n) {
24
+ rep(i,0,n) {
25
P np = p[(i + 1) % n];
26
if (onSegment(p[i], np, a)) return !strict;
27
+ //or: if (segDist(p[i], np, a) <= eps) return !strict;
28
cnt += ((a.y>=np.y)-(a.y>=p[i].y))*a.cross(p[i],np) > 0;
29
}
30
return cnt & 1;
0 commit comments