From aac82dc5ba80da61a1f6ab688c4edc4a66a31998 Mon Sep 17 00:00:00 2001 From: Kyungmo Ku <46951576+Pentagon03@users.noreply.github.com> Date: Tue, 6 Aug 2024 10:42:15 +0900 Subject: [PATCH] Update cp-geo.json --- Geometry/cp-geo.json | 215 +++++++++++++++++++++---------------------- 1 file changed, 107 insertions(+), 108 deletions(-) diff --git a/Geometry/cp-geo.json b/Geometry/cp-geo.json index aecd6f3..c215d02 100644 --- a/Geometry/cp-geo.json +++ b/Geometry/cp-geo.json @@ -1,10 +1,9 @@ "geometry": { "prefix": "geo", - "scope": "cpp", "body": [ "// from: https://codeforces.com/contest/1936/submission/249350779", "namespace geometry { // https://victorlecomte.com/cp-geo.pdf", - " using ld = double;", + " using ld = long double;", " const ld inf = 1e100;", " const ld eps = 1e-9;", " const ld PI = acos((ld) -1.0);", @@ -75,31 +74,31 @@ " void polar_sort(vector &v, PT o) { // sort points in counterclockwise with respect to point o", " sort(v.begin(), v.end(), [&](PT a, PT b) {", " return make_tuple(half(a - o), 0.0, (a - o).norm2()) <", - " make_tuple(half(b - o), cross(a - o, b - o), (b - o).norm2());", + " make_tuple(half(b - o), cross(a - o, b - o), (b - o).norm2());", " });", " }", - " ", + "", " // # LINE START", " struct line {", " PT a, b; // goes through points a and b", " PT v;", " ld c; //line form: direction vec [cross] (x, y) = c", " line() {}", - " ", + "", " //direction vector v and offset c", " line(PT v, ld c) : v(v), c(c) {", " auto p = get_points();", " a = p.first;", " b = p.second;", " }", - " ", + "", " // equation ax + by + c = 0", " line(ld _a, ld _b, ld _c) : v({_b, -_a}), c(-_c) {", " auto p = get_points();", " a = p.first;", " b = p.second;", " }", - " ", + "", " // goes through points p and q", " line(PT p, PT q) : v(q - p), c(cross(v, p)), a(p), b(q) {}", " pair get_points() { //extract any two points from this line", @@ -117,54 +116,54 @@ " }", " return {p, q};", " }", - " ", + "", " // ax + by + c = 0", " array get_abc() {", " ld a = -v.y, b = v.x;", " return {a, b, -c};", " }", - " ", + "", " // 1 if on the left, -1 if on the right, 0 if on the line", " int side(PT p) { return sign(cross(v, p) - c); }", - " ", + "", " // line that is perpendicular to this and goes through point p", " line perpendicular_through(PT p) { return {p, p + perp(v)}; }", - " ", + "", " // translate the line by vector t i.e. shifting it by vector t", " line translate(PT t) { return {v, c + cross(v, t)}; }", - " ", + "", " // compare two points by their orthogonal projection on this line", " // a projection point comes before another if it comes first according to vector v", " bool cmp_by_projection(PT p, PT q) { return dot(v, p) < dot(v, q); }", - " ", + "", " line shift_left(ld d) {", " PT z = v.perp().truncate(d);", " return line(a + z, b + z);", " }", " };", - " ", + "", " // find a point from a through b with distance d", " PT point_along_line(PT a, PT b, ld d) {", " assert(a != b);", " return a + (((b - a) / (b - a).norm()) * d);", " }", - " ", + "", " // projection point c onto line through a and b assuming a != b", " PT project_from_point_to_line(PT a, PT b, PT c) {", " return a + (b - a) * dot(c - a, b - a) / (b - a).norm2();", " }", - " ", + "", " // reflection point c onto line through a and b assuming a != b", " PT reflection_from_point_to_line(PT a, PT b, PT c) {", " PT p = project_from_point_to_line(a, b, c);", " return p + p - c;", " }", - " ", + "", " // minimum distance from point c to line through a and b", " ld dist_from_point_to_line(PT a, PT b, PT c) {", " return fabs(cross(b - a, c - a) / (b - a).norm());", " }", - " ", + "", " // returns true if point p is on line segment ab", " bool is_point_on_seg(PT a, PT b, PT p) {", " if (fabs(cross(p - b, a - b)) < eps) {", @@ -174,7 +173,7 @@ " }", " return false;", " }", - " ", + "", " // minimum distance point from point c to segment ab that lies on segment ab", " PT project_from_point_to_seg(PT a, PT b, PT c) {", " ld r = dist2(a, b);", @@ -184,12 +183,12 @@ " if (r > 1) return b;", " return a + (b - a) * r;", " }", - " ", + "", " // minimum distance from point c to segment ab", " ld dist_from_point_to_seg(PT a, PT b, PT c) {", " return dist(c, project_from_point_to_seg(a, b, c));", " }", - " ", + "", " // 0 if not parallel, 1 if parallel, 2 if collinear", " int is_parallel(PT a, PT b, PT c, PT d) {", " ld k = fabs(cross(b - a, d - c));", @@ -198,19 +197,19 @@ " else return 1;", " } else return 0;", " }", - " ", + "", " // check if two lines are same", " bool are_lines_same(PT a, PT b, PT c, PT d) {", " if (fabs(cross(a - c, c - d)) < eps && fabs(cross(b - c, c - d)) < eps) return true;", " return false;", " }", - " ", + "", " // bisector vector of 0) return 2;", " return 3;", " }", - " ", + "", " // intersection point between ab and cd assuming unique intersection exists", " bool line_line_intersection(PT a, PT b, PT c, PT d, PT &ans) {", " ld a1 = a.y - b.y, b1 = b.x - a.x, c1 = cross(a, b);", @@ -228,7 +227,7 @@ " ans = PT((b1 * c2 - b2 * c1) / det, (c1 * a2 - a1 * c2) / det);", " return 1;", " }", - " ", + "", " // intersection point between segment ab and segment cd assuming unique intersection exists", " bool seg_seg_intersection(PT a, PT b, PT c, PT d, PT &ans) {", " ld oa = cross2(c, d, a), ob = cross2(c, d, b);", @@ -238,7 +237,7 @@ " return 1;", " } else return 0;", " }", - " ", + "", "// intersection point between segment ab and segment cd assuming unique intersection may not exists", "// se.size()==0 means no intersection", "// se.size()==1 means one intersection", @@ -253,7 +252,7 @@ " if (is_point_on_seg(a, b, d)) se.insert(d);", " return se;", " }", - " ", + "", "// intersection between segment ab and line cd", "// 0 if do not intersect, 1 if proper intersect, 2 if segment intersect", " int seg_line_relation(PT a, PT b, PT c, PT d) {", @@ -263,7 +262,7 @@ " else if (p * q < 0) return 1;", " else return 0;", " }", - " ", + "", "// intersection between segament ab and line cd assuming unique intersection exists", " bool seg_line_intersection(PT a, PT b, PT c, PT d, PT &ans) {", " bool k = seg_line_relation(a, b, c, d);", @@ -271,7 +270,7 @@ " if (k) line_line_intersection(a, b, c, d, ans);", " return k;", " }", - " ", + "", "// minimum distance from segment ab to segment cd", " ld dist_from_seg_to_seg(PT a, PT b, PT c, PT d) {", " PT dummy;", @@ -280,7 +279,7 @@ " return min({dist_from_point_to_seg(a, b, c), dist_from_point_to_seg(a, b, d),", " dist_from_point_to_seg(c, d, a), dist_from_point_to_seg(c, d, b)});", " }", - " ", + "", "// minimum distance from point c to ray (starting point a and direction vector b)", " ld dist_from_point_to_ray(PT a, PT b, PT c) {", " b = a + b;", @@ -288,7 +287,7 @@ " if (r < 0.0) return dist(c, a);", " return dist_from_point_to_line(a, b, c);", " }", - " ", + "", "// starting point as and direction vector ad", " bool ray_ray_intersection(PT as, PT ad, PT bs, PT bd) {", " ld dx = bs.x - as.x, dy = bs.y - as.y;", @@ -305,19 +304,19 @@ " ans = min(ans, dist_from_point_to_ray(bs, bd, as));", " return ans;", " }", - " ", + "", " // # CIRCLE START", " struct circle {", " PT p;", " ld r;", - " ", + "", " circle() {}", - " ", + "", " circle(PT _p, ld _r) : p(_p), r(_r) {};", - " ", + "", " // center (x, y) and radius r", " circle(ld x, ld y, ld _r) : p(PT(x, y)), r(_r) {};", - " ", + "", " // circumcircle of a triangle", " // the three points must be unique", " circle(PT a, PT b, PT c) {", @@ -326,7 +325,7 @@ " line_line_intersection(b, b + rotatecw90(a - b), c, c + rotatecw90(a - c), p);", " r = dist(a, p);", " }", - " ", + "", " // inscribed circle of a triangle", " // pass a bool just to differentiate from circumcircle", " circle(PT a, PT b, PT c, bool t) {", @@ -340,14 +339,14 @@ " line_line_intersection(u.a, u.b, v.a, v.b, p);", " r = dist_from_point_to_seg(a, b, p);", " }", - " ", + "", " bool operator==(circle v) { return p == v.p && sign(r - v.r) == 0; }", - " ", + "", " ld area() { return PI * r * r; }", - " ", + "", " ld circumference() { return 2.0 * PI * r; }", " };", - " ", + "", " //0 if outside, 1 if on circumference, 2 if inside circle", " int circle_point_relation(PT p, ld r, PT b) {", " ld d = dist(p, b);", @@ -355,7 +354,7 @@ " if (sign(d - r) == 0) return 1;", " return 0;", " }", - " ", + "", " // 0 if outside, 1 if on circumference, 2 if inside circle", " int circle_line_relation(PT p, ld r, PT a, PT b) {", " ld d = dist_from_point_to_line(a, b, p);", @@ -363,7 +362,7 @@ " if (sign(d - r) == 0) return 1;", " return 0;", " }", - " ", + "", " //compute intersection of line through points a and b with", " //circle centered at c with radius r > 0", " vector circle_line_intersection(PT c, ld r, PT a, PT b) {", @@ -377,7 +376,7 @@ " if (D > eps) ret.push_back(c + a + b * (-B - sqrt(D)) / A);", " return ret;", " }", - " ", + "", " //5 - outside and do not intersect", " //4 - intersect outside in one point", " //3 - intersect in 2 points", @@ -394,7 +393,7 @@ " assert(0);", " return -1;", " }", - " ", + "", " vector circle_circle_intersection(PT a, ld r, PT b, ld R) {", " if (a == b && sign(r - R) == 0) return {PT(1e18, 1e18)};", " vector ret;", @@ -407,7 +406,7 @@ " if (y > 0) ret.push_back(a + v * x - rotateccw90(v) * y);", " return ret;", " }", - " ", + "", " // returns two circle c1, c2 through points a, b and of radius r", " // 0 if there is no such circle, 1 if one circle, 2 if two circle", " int get_circle(PT a, PT b, ld r, circle &c1, circle &c2) {", @@ -418,7 +417,7 @@ " if (t == 2) c2.p = v[1], c2.r = r;", " return t;", " }", - " ", + "", " // returns two circle c1, c2 which is tangent to line u, goes through", " // point q and has radius r1; 0 for no circle, 1 if c1 = c2 , 2 if c1 != c2", " int get_circle(line u, PT q, ld r1, circle &c1, circle &c2) {", @@ -448,7 +447,7 @@ " c2 = circle(p2, r1);", " return 2;", " }", - " ", + "", " // returns the circle such that for all points w on the circumference of the circle", " // dist(w, a) : dist(w, b) = rp : rq", " // rp != rq", @@ -469,7 +468,7 @@ " r = sqrt(r);", " return circle(o, r);", " }", - " ", + "", " // returns area of intersection between two circles", " ld circle_circle_area(PT a, ld r1, PT b, ld r2) {", " ld d = (a - b).norm();", @@ -480,7 +479,7 @@ " theta_2 = acos((r2 * r2 + d * d - r1 * r1) / (2 * r2 * d));", " return r1 * r1 * (theta_1 - sin(2 * theta_1) / 2.) + r2 * r2 * (theta_2 - sin(2 * theta_2) / 2.);", " }", - " ", + "", " // tangent lines from point q to the circle", " int tangent_lines_from_point(PT p, ld r, PT q, line &u, line &v) {", " int x = sign(dist2(p, q) - r * r);", @@ -497,7 +496,7 @@ " v = line(q, p + ((q - p).truncate(l) + (rotatecw90(q - p).truncate(h))));", " return 2;", " }", - " ", + "", " // returns outer tangents line of two circles", " // if inner == 1 it returns inner tangent lines", " int tangents_lines_from_circle(PT c1, ld r1, PT c2, ld r2, bool inner, line &u, line &v) {", @@ -517,7 +516,7 @@ " if (out.size() == 2) v = line(out[1].first, out[1].second);", " return 1 + (h2 > 0);", " }", - " ", + "", " // O(n^2 log n)", " // https://vjudge.net/problem/UVA-12056", " constexpr int MX_UNION = 2020;", @@ -615,13 +614,13 @@ " return pol / 2.0 + arc;", " }", " } CU;", - " ", + "", " // # POLYGON START", - " ", + "", " ld area_of_triangle(PT a, PT b, PT c) {", " return fabs(cross(b - a, c - a) * 0.5);", " }", - " ", + "", " // -1 if strictly inside, 0 if on the polygon, 1 if strictly outside", " int is_point_in_triangle(PT a, PT b, PT c, PT p) {", " if (sign(cross(b - a, c - a)) < 0) swap(b, c);", @@ -632,21 +631,21 @@ " if (c1 + c2 + c3 != 3) return 0;", " return -1;", " }", - " ", + "", " ld perimeter(vector &p) {", " ld ans = 0;", " int n = p.size();", " for (int i = 0; i < n; i++) ans += dist(p[i], p[(i + 1) % n]);", " return ans;", " }", - " ", + "", " ld area(vector &p) {", " ld ans = 0;", " int n = p.size();", " for (int i = 0; i < n; i++) ans += cross(p[i], p[(i + 1) % n]);", " return fabs(ans) * 0.5;", " }", - " ", + "", " // centroid of a (possibly non-convex) polygon,", " // assuming that the coordinates are listed in a clockwise or", " // counterclockwise fashion. Note that the centroid is often known as", @@ -663,7 +662,7 @@ " }", " return c / scale;", " }", - " ", + "", " // 0 if cw, 1 if ccw", " bool get_direction(vector &p) {", " ld ans = 0;", @@ -672,7 +671,7 @@ " if (sign(ans) > 0) return 1;", " return 0;", " }", - " ", + "", " // it returns a point such that the sum of distances", " // from that point to all points in p is minimum", " // O(n log^2 MX)", @@ -710,7 +709,7 @@ " }", " return {xl, findY(xl).first};", " }", - " ", + "", " vector convex_hull(vector &p) {", " if (p.size() <= 1) return p;", " vector v = p;", @@ -736,7 +735,7 @@ " if (v.size() == 2 && v[0] == v[1]) v.pop_back();", " return v;", " }", - " ", + "", " //checks if convex or not", " bool is_convex(vector &p) {", " bool s[3];", @@ -750,7 +749,7 @@ " }", " return 1;", " }", - " ", + "", " // -1 if strictly inside, 0 if on the polygon, 1 if strictly outside", " // it must be strictly convex, otherwise make it strictly convex first", " int is_point_in_convex(vector &p, const PT &x) { // O(log n)", @@ -770,7 +769,7 @@ " if (r == n - 1 && b == 0) return 0;", " return -1;", " }", - " ", + "", " bool is_point_on_polygon(vector &p, const PT &z) {", " int n = p.size();", " for (int i = 0; i < n; i++) {", @@ -778,7 +777,7 @@ " }", " return 0;", " }", - " ", + "", " // returns 1e9 if the point is on the polygon", " int winding_number(vector &p, const PT &z) { // O(n)", " if (is_point_on_polygon(p, z)) return 1e9;", @@ -794,13 +793,13 @@ " }", " return ans;", " }", - " ", + "", " // -1 if strictly inside, 0 if on the polygon, 1 if strictly outside", " int is_point_in_polygon(vector &p, const PT &z) { // O(n)", " int k = winding_number(p, z);", " return k == 1e9 ? 0 : k == 0 ? 1 : -1;", " }", - " ", + "", " // id of the vertex having maximum dot product with z", " // polygon must need to be convex", " // top - upper right vertex", @@ -828,7 +827,7 @@ " if (dot(p[l], z) > ans) ans = dot(p[l], z), id = l;", " return id;", " }", - " ", + "", " // maximum distance from any point on the perimeter to another point on the perimeter", " ld diameter(vector &p) {", " int n = (int) p.size();", @@ -846,7 +845,7 @@ " }", " return sqrt(ans);", " }", - " ", + "", " // minimum distance between two parallel lines (non necessarily axis parallel)", " // such that the polygon can be put between the lines", " ld width(vector &p) {", @@ -861,7 +860,7 @@ " }", " return ans;", " }", - " ", + "", " // minimum perimeter", " ld minimum_enclosing_rectangle(vector &p) {", " int n = p.size();", @@ -881,13 +880,13 @@ " while (cross(cur, p[(j + 1) % n] - p[j]) >= 0) j = (j + 1) % n;", " while (dot(p[(mxdot + 1) % n], cur) >= dot(p[mxdot], cur)) mxdot = (mxdot + 1) % n;", " while (dot(p[(mndot + 1) % n], cur) <= dot(p[mndot], cur)) mndot = (mndot + 1) % n;", - " ans = min(ans, 2.0 * ((dot(p[mxdot], cur) / cur.norm() - dot(p[mndot], cur) / cur.norm()) +", - " dist_from_point_to_line(p[i], p[(i + 1) % n], p[j])));", + " ans = min(ans,(ld) (2.0 * ((dot(p[mxdot], cur) / cur.norm() - dot(p[mndot], cur) / cur.norm()) +", + " dist_from_point_to_line(p[i], p[(i + 1) % n], p[j])) ));", " i++;", " }", " return ans;", " }", - " ", + "", " // given n points, find the minimum enclosing circle of the points", " // call convex_hull() before this for faster solution", " // expected O(n)", @@ -912,7 +911,7 @@ " }", " return c;", " }", - " ", + "", " // returns a vector with the vertices of a polygon with everything", " // to the left of the line going from a to b cut away.", " vector cut(vector &p, PT a, PT b) {", @@ -932,7 +931,7 @@ " }", " return ans;", " }", - " ", + "", " // not necessarily convex, boundary is included in the intersection", " // returns total intersected length", " // it returns the sum of the lengths of the portions of the line that are inside the polygon", @@ -964,7 +963,7 @@ " p.pop_back();", " return ans;", " }", - " ", + "", " // given a convex polygon p, and a line ab and the top vertex of the polygon", " // returns the intersection of the line with the polygon", " // it returns the indices of the edges of the polygon that are intersected by the line", @@ -995,7 +994,7 @@ " }", " return res; // intersects the edges (res[0], res[0] + 1) and (res[1], res[1] + 1)", " }", - " ", + "", " pair point_poly_tangent(vector &p, PT Q, int dir, int l, int r) {", " while (r - l > 1) {", " int mid = (l + r) >> 1;", @@ -1022,7 +1021,7 @@ " for (int i = l + 1; i <= r; i++) ret = orientation(Q, ret.first, p[i]) != dir ? make_pair(p[i], i) : ret;", " return ret;", " }", - " ", + "", " // (ccw, cw) tangents from a point that is outside this convex polygon", " // returns indexes of the points", " // ccw means the tangent from Q to that point is in the same direction as the polygon ccw direction", @@ -1031,7 +1030,7 @@ " int cw = point_poly_tangent(p, Q, -1, 0, (int) p.size() - 1).second;", " return make_pair(ccw, cw);", " }", - " ", + "", " // minimum distance from a point to a convex polygon", " // it assumes point lie strictly outside the polygon", " ld dist_from_point_to_polygon(vector &p, PT z) {", @@ -1055,7 +1054,7 @@ " ans = min(ans, dist_from_point_to_seg(p[l % n], p[(l - 1 + n) % n], z));", " return ans;", " }", - " ", + "", " // minimum distance from convex polygon p to line ab", " // returns 0 is it intersects with the polygon", " // top - upper right vertex", @@ -1067,7 +1066,7 @@ " return 0.0; //if orth and a are in the same half of the line, then poly and line intersects", " return dist_from_point_to_line(a, b, p[id]); //does not intersect", " }", - " ", + "", " // minimum distance from a convex polygon to another convex polygon", " // the polygon doesnot overlap or touch", " // tested in https://toph.co/p/the-wall", @@ -1081,7 +1080,7 @@ " }", " return ans;", " }", - " ", + "", " // maximum distance from a convex polygon to another convex polygon", " ld maximum_dist_from_polygon_to_polygon(vector &u, vector &v) { //O(n)", " int n = (int) u.size(), m = (int) v.size();", @@ -1102,14 +1101,14 @@ " }", " return sqrt(ans);", " }", - " ", + "", " // calculates the area of the union of n polygons (not necessarily convex).", " // the points within each polygon must be given in CCW order.", " // complexity: O(N^2), where N is the total number of points", " ld rat(PT a, PT b, PT p) {", " return !sign(a.x - b.x) ? (p.y - a.y) / (b.y - a.y) : (p.x - a.x) / (b.x - a.x);", " };", - " ", + "", " ld polygon_union(vector> &p) {", " int n = p.size();", " ld ans = 0;", @@ -1149,18 +1148,18 @@ " }", " return ans * 0.5;", " }", - " ", + "", " // # HALF PLANE START", " // contains all points p such that: cross(b - a, p - a) >= 0", " struct HP {", " PT a, b;", - " ", + "", " HP() {}", - " ", + "", " HP(PT a, PT b) : a(a), b(b) {}", - " ", + "", " HP(const HP &rhs) : a(rhs.a), b(rhs.b) {}", - " ", + "", " int operator<(const HP &rhs) const {", " PT p = b - a;", " PT q = rhs.b - rhs.a;", @@ -1170,24 +1169,24 @@ " if (cross(p, q)) return cross(p, q) > 0;", " return cross(p, rhs.b - a) < 0;", " }", - " ", + "", " PT line_line_intersection(PT a, PT b, PT c, PT d) {", " b = b - a;", " d = c - d;", " c = c - a;", " return a + b * cross(c, d) / cross(b, d);", " }", - " ", + "", " PT intersection(const HP &v) {", " return line_line_intersection(a, b, v.a, v.b);", " }", " };", - " ", + "", " int check(HP a, HP b, HP c) {", " return cross(a.b - a.a, b.intersection(c) - a.a) >", - " -eps; //-eps to include polygons of zero area (straight lines, points)", + " -eps; //-eps to include polygons of zero area (straight lines, points)", " }", - " ", + "", " // consider half-plane of counter-clockwise side of each line", " // if lines are not bounded add infinity rectangle", " // returns a convex polygon, a point can occur multiple times though", @@ -1220,7 +1219,7 @@ " }", " return hull;", " }", - " ", + "", " // rotate the polygon such that the (bottom, left)-most point is at the first position", " void reorder_polygon(vector &p) {", " int pos = 0;", @@ -1229,7 +1228,7 @@ " }", " rotate(p.begin(), p.begin() + pos, p.end());", " }", - " ", + "", " // a and b are convex polygons", " // returns a convex hull of their minkowski sum", " // min(a.size(), b.size()) >= 2", @@ -1252,7 +1251,7 @@ " }", " return c;", " }", - " ", + "", " // returns the area of the intersection of the circle with center c and radius r", " // and the triangle formed by the points c, a, b", " ld _triangle_circle_intersection(PT c, ld r, PT a, PT b) {", @@ -1285,7 +1284,7 @@ " }", " return area;", " }", - " ", + "", " // intersection between a simple polygon and a circle", " ld polygon_circle_intersection(vector &v, PT p, ld r) {", " int n = v.size();", @@ -1300,7 +1299,7 @@ " }", " return abs(ans);", " }", - " ", + "", " // find a circle of radius r that contains as many points as possible", " // O(n^2 log n);", " ld maximum_circle_cover(vector p, ld r, circle &c) {", @@ -1345,7 +1344,7 @@ " c = circle(w, r); //best_circle", " return ans;", " }", - " ", + "", " // radius of the maximum inscribed circle in a convex polygon", " ld maximum_inscribed_circle(vector p) {", " int n = p.size();", @@ -1371,7 +1370,7 @@ " }", " return l;", " }", - " ", + "", " // ear decomposition, O(n^3) but faster", " vector> triangulate(vector p) {", " vector> v;", @@ -1399,7 +1398,7 @@ " }", " return v;", " }", - " ", + "", " // # STAR START", " struct star {", " int n; // number of sides of the star", @@ -1408,7 +1407,7 @@ " n = _n;", " r = _r;", " }", - " ", + "", " ld area() {", " ld theta = PI / n;", " ld s = 2 * r * sin(theta);", @@ -1418,7 +1417,7 @@ " return a - n * a2;", " }", " };", - " ", + "", " // given a list of lengths of the sides of a polygon in counterclockwise order", " // returns the maximum area of a non-degenerate polygon that can be formed using those lengths", " ld get_maximum_polygon_area_for_given_lengths(vector v) {", @@ -1459,7 +1458,7 @@ " l = mid;", " }", " }", - " ", + "", " if (calc(r) <= 2 * PI - eps) { // the center of the circle is outside the polygon", " auto calc2 = [&](ld r) {", " ld sum = 0;", @@ -1511,9 +1510,9 @@ " }", " }", "}", - " ", + "", "using geometry::PT;", "using geometry::ld;" ], "description": "geometry" -} \ No newline at end of file +}