Documentation

Moser.Geometry.Polygon

Convex Polygons #

This file defines convex polygons as ordered lists of rational vertices.

A polygon represented by its vertices.

we require that all vertices are distinct, and that there are 3 or more vertices.

Operations that would return a degenerate polygon (fewer than 3 vertices) return none instead.

Note we do not extend mathlib's Polygon, because we want to bundle the vertex count.

Instances For
    Equations
    • One or more equations did not get rendered due to their size.
    Instances For
      Equations
      • One or more equations did not get rendered due to their size.
      Instances For

        The open half-space strictly to the left of the directed edge from vertex i to vertex i+1.

        Equations
        Instances For

          A convex polygon.

          Convexity is enforced by the condition that for each edge i→i+1, all other vertices lie strictly to the left of that edge.

          The strictness enforces that there can be no collinear triples of vertices, which in turn ensures that all vertices are extreme points of the convex hull.

          Instances For
            Equations
            • One or more equations did not get rendered due to their size.
            Instances For
              def instDecidableEqConvexPolygon.decEq (x✝ x✝¹ : ConvexPolygon) :
              Decidable (x✝ = x✝¹)
              Equations
              • One or more equations did not get rendered due to their size.
              Instances For

                The vertex list of a convex polygon, in counterclockwise order.

                Equations
                Instances For

                  Graham scan helper: process remaining points to build upper/lower hull

                  Equations
                  Instances For

                    Compute the convex hull of a list of points using a Graham-scan-like algorithm. Should return a list of vertices such that:

                    • All points in the returned list are in the input list (no new points).
                    • The returned list has no duplicates.
                    • The returned list starts with the lowest x-coordinate point (lowest y-coordinate to tiebreak) and then goes in counterclockwise order.
                    • All input points are in the convex hull defined by the returned vertices.
                    • The returned vertices are extreme points of the convex hull (no vertex is a convex combination of others).
                    Equations
                    Instances For

                      Construct a ConvexPolygon from a list of points by removing duplicates and keeping only extreme points of the convex hull. returns none if there are fewer than 3 extreme points.

                      Equations
                      Instances For

                        Returns a list of closed half-spaces corresponding to the edges of the convex polygon. If there are fewer than 3 vertices, returns none.

                        Equations
                        • One or more equations did not get rendered due to their size.
                        Instances For

                          Given a collection of half-spaces, construct the convex polygon defined by their intersection. This is determined by taking all intersections of the boundary lines of pairs of half-spaces, and then filtering to those that satisfy all half-space constraints.

                          Equations
                          • One or more equations did not get rendered due to their size.
                          Instances For

                            Decide whether the point p lies in the convex polygon poly.

                            Equations
                            Instances For

                              Decide whether every vertex of p lies in q, witnessing p ⊆ q for convex polygons.

                              Equations
                              Instances For
                                def ConvexPolygon.shrink (poly : ConvexPolygon) (dist tolerance : ) (hdist : 0 < dist) (htol : 0 < tolerance) :

                                Shrink a convex polygon by moving each edge inward by at least dist (in the normal direction). and at most dist + tolerance (to account for numerical issues).

                                Equations
                                • One or more equations did not get rendered due to their size.
                                Instances For