Skip to content

Commit c3250a2

Browse files
AbdeltwabMFadamant-pwn
authored andcommitted
Handle the degenerate case of two identical points.
This fix addresses the situation where the convex hull consists of two identical points and the hull is strictly convex (i.e., collinear points are not included).
1 parent 525c3af commit c3250a2

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/geometry/convex-hull.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@ void convex_hull(vector<pt>& a, bool include_collinear = false) {
8686
st.push_back(a[i]);
8787
}
8888

89+
if (include_collinear == false && st.size() == 2 && st[0] == st[1])
90+
st.pop_back();
91+
8992
a = st;
9093
}
9194
```

0 commit comments

Comments
 (0)