232's competitive-programming templates./geometry
-
Geometry232's competitive-programming templates./geometry 2024. 10. 27. 13:04
namespace Geometry { using F = long double; template struct PointBase { constexpr static T eps = T(1E-9); T x; T y; PointBase() : x(0), y(0) { void(0); } PointBase(T x, T y) : x(x), y(y) { void(0); } template operator PointBase() const { return {U(x), U(y)}; } friend PointBase operator-(const PointBase& a, const PointBase& b) { return {a...
-
(useless) furthestPoints (rotating calipers)232's competitive-programming templates./geometry 2024. 10. 23. 16:26
upd : now all in Geometry..std::pair furthestPoints(const std::vector& pts) { assert(!pts.empty()); auto hull = getConvexHull(pts); int n = hull.size(); G max_dist = -1; std::pair res; for (int i = 0, j = 0; i = 0) { j = (j + 1) % n; if (auto d = dist2(hull[i], hull[j]); max_dist