Skip to content

Commit d10040e

Browse files
committed
Readded segDist option
1 parent f5c8b59 commit d10040e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

content/geometry/insidePolygon.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,15 @@
1616

1717
#include "Point.h"
1818
#include "onSegment.h"
19+
#include "SegmentDistance.h"
1920

2021
template<class P>
2122
bool inPolygon(vector<P> &p, P a, bool strict = true) {
2223
int cnt = 0, n = sz(p);
23-
rep(i, 0, n) {
24+
rep(i,0,n) {
2425
P np = p[(i + 1) % n];
2526
if (onSegment(p[i], np, a)) return !strict;
27+
//or: if (segDist(p[i], np, a) <= eps) return !strict;
2628
cnt += ((a.y>=np.y)-(a.y>=p[i].y))*a.cross(p[i],np) > 0;
2729
}
2830
return cnt & 1;

0 commit comments

Comments
 (0)