Skip to content

Commit 4e7566e

Browse files
committed
Readded segDist option
1 parent f5c8b59 commit 4e7566e

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

content/geometry/insidePolygon.h

Lines changed: 2 additions & 0 deletions
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);
2324
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)