Skip to content

Commit 201c51c

Browse files
committed
Update PolygonCut after line intersection changes
1 parent 58d72c4 commit 201c51c

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

content/geometry/PolygonCut.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,8 @@ vector<P> polygonCut(const vector<P>& poly, P s, P e) {
2828
rep(i,0,sz(poly)) {
2929
P cur = poly[i], prev = i ? poly[i-1] : poly.back();
3030
bool side = s.cross(e, cur) < 0;
31-
if (side != (s.cross(e, prev) < 0)) {
32-
res.emplace_back();
33-
lineIntersection(s, e, cur, prev, res.back());
34-
}
31+
if (side != (s.cross(e, prev) < 0))
32+
res.push_back(lineInter(s, e, cur, prev).second);
3533
if (side)
3634
res.push_back(cur);
3735
}

0 commit comments

Comments
 (0)