From 5ab8a5088b729a9953b8dff1b2a985dc8fb2098b Mon Sep 17 00:00:00 2001 From: mzuenni Date: Mon, 27 Jun 2022 17:19:28 +0200 Subject: updated tcr --- geometry/antipodalPoints.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 geometry/antipodalPoints.cpp (limited to 'geometry/antipodalPoints.cpp') diff --git a/geometry/antipodalPoints.cpp b/geometry/antipodalPoints.cpp new file mode 100644 index 0000000..c1921cc --- /dev/null +++ b/geometry/antipodalPoints.cpp @@ -0,0 +1,13 @@ +vector> antipodalPoints(vector& h) { + vector> result; + int n = (int)h.size(); + if (n < 2) return result; + for (int i = 0, j = 1; i < j; i++) { + while (true) { + result.push_back({i, j}); + if (cross(h[(i + 1) % n] - h[i], + h[(j + 1) % n] - h[j]) <= 0) break; + j = (j + 1) % n; + }} + return result; +} -- cgit v1.2.3