diff options
| author | Gloria Mundi <gloria@gloria-mundi.eu> | 2024-11-16 01:24:14 +0100 |
|---|---|---|
| committer | Gloria Mundi <gloria@gloria-mundi.eu> | 2024-11-16 01:24:14 +0100 |
| commit | 98567ec798aa8ca2cfbcb85c774dd470f30e30d4 (patch) | |
| tree | 5113d5cc24d1ad5f93810b6442ce584a36950dc8 /geometry/convexHull.cpp | |
| parent | ad3856a6b766087df0036de0b556f4700a6498c9 (diff) | |
| parent | 8d11c6c8213f46f0fa19826917c255edd5d43cb1 (diff) | |
mzuenni tests
Diffstat (limited to 'geometry/convexHull.cpp')
| -rw-r--r-- | geometry/convexHull.cpp | 19 |
1 files changed, 0 insertions, 19 deletions
diff --git a/geometry/convexHull.cpp b/geometry/convexHull.cpp deleted file mode 100644 index b1de170..0000000 --- a/geometry/convexHull.cpp +++ /dev/null @@ -1,19 +0,0 @@ -vector<pt> convexHull(vector<pt> pts){ - sort(all(pts), [](const pt& a, const pt& b){ - return real(a) == real(b) ? imag(a) < imag(b) - : real(a) < real(b); - }); - pts.erase(unique(all(pts)), pts.end()); - int k = 0; - vector<pt> h(2 * sz(pts)); - for (int i = 0; i < sz(pts); i++) {// Untere Hülle. - while (k > 1 && cross(h[k-2], h[k-1], pts[i]) <= 0) k--; - h[k++] = pts[i]; - } - for (int i = sz(pts)-2, t = k; i >= 0; i--) {// Obere Hülle. - while (k > t && cross(h[k-2], h[k-1], pts[i]) <= 0) k--; - h[k++] = pts[i]; - } - h.resize(k); - return h; -} |
