The areas / V22. Affine, Euclidean and convex geometry
Mathlib.Geometry.Polygon.Basic
23 declarations. Mathlib docs · Source
Polygons
This file defines polygons in affine spaces.
For the special case n = 3, an interconversion is provided with Affine.Triangle.
Main definitions
Polygon P n: A polygon withnvertices in a typeP.
Interconversion with Affine.Triangle
theorem Polygon.mk.inj E1 #
∀ {P : Type u_1} {n : ℕ} {vertices vertices_1 : Fin n → P},
{ vertices := vertices } = { vertices := vertices_1 } → vertices = vertices_1
theorem Polygon.mk.injEq E0 #
∀ {P : Type u_1} {n : ℕ} (vertices vertices_1 : Fin n → P),
({ vertices := vertices } = { vertices := vertices_1 }) = (vertices = vertices_1)
def Polygon.ctorIdx E1 #
{P : Type u_1} → {n : ℕ} → Polygon P n → ℕ
structure Polygon E1 #
Type u_1 → ℕ → Type u_1
A polygon with n vertices in a type P.
ctor Polygon.mk E0 #
{P : Type u_1} → {n : ℕ} → (Fin n → P) → Polygon P n
abbrev Polygon.vertices E1 #
{P : Type u_1} → {n : ℕ} → Polygon P n → Fin n → P
The vertices of the polygon, indexed by Fin n.
instance Polygon.instCoeFunForallFin E0 #
{P : Type u_3} → {n : ℕ} → CoeFun (Polygon P n) fun x ↦ Fin n → P
A coercion to function so that vertices can
be written as poly i instead of poly.vertices i
def Polygon.HasNondegenerateEdges E1 #
{P : Type u_3} → {n : ℕ} → Polygon P n → Prop
A polygon has nondegenerate edges if adjacent vertices are distinct.
theorem Polygon.HasNondegenerateEdges.two_le E1 #
∀ {P : Type u_3} {n : ℕ} [NeZero n] {poly : Polygon P n}, poly.HasNondegenerateEdges → 2 ≤ n
def Polygon.edgePath E1 #
(R : Type u_1) →
{V : Type u_2} →
{P : Type u_3} →
{n : ℕ} →
[inst : Ring R] →
[inst_1 : AddCommGroup V] → [inst_2 : Module R V] → [inst_3 : AddTorsor V P] → Polygon P n → Fin n → R →ᵃ[R] P
The i-th edge as an affine map R →ᵃ[R] P.
def Polygon.edgeSet E1 #
(R : Type u_1) →
{V : Type u_2} →
{P : Type u_3} →
{n : ℕ} →
[inst : Ring R] →
[inst_1 : AddCommGroup V] → [Module R V] → [AddTorsor V P] → [PartialOrder R] → Polygon P n → Fin n → Set P
The i-th edge as a set of points using an affineSegment.
theorem Polygon.edgeSet_eq_image_edgePath E1 #
∀ (R : Type u_1) {V : Type u_2} {P : Type u_3} {n : ℕ} [inst : Ring R] [inst_1 : AddCommGroup V] [inst_2 : Module R V]
[inst_3 : AddTorsor V P] [inst_4 : PartialOrder R] (poly : Polygon P n) (i : Fin n),
Polygon.edgeSet R poly i = ⇑(Polygon.edgePath R poly i) '' Set.Icc 0 1
The edgeSet is equivalent to the image of the edgePath.
def Polygon.boundary E1 #
(R : Type u_1) →
{V : Type u_2} →
{P : Type u_3} →
{n : ℕ} →
[inst : Ring R] →
[inst_1 : AddCommGroup V] → [Module R V] → [AddTorsor V P] → [PartialOrder R] → Polygon P n → Set P
The boundary of the polygon is the union of all its edges.
def Polygon.HasNondegenerateVertices E1 #
(R : Type u_1) →
{V : Type u_2} →
{P : Type u_3} →
{n : ℕ} →
[inst : Ring R] → [inst_1 : AddCommGroup V] → [Module R V] → [AddTorsor V P] → [NeZero n] → Polygon P n → Prop
A polygon has nondegenerate vertices if any three consecutive vertices are affinely independent.
theorem Polygon.HasNondegenerateVertices.hasNondegenerateEdges E1 #
∀ {R : Type u_1} {V : Type u_2} {P : Type u_3} {n : ℕ} [inst : Ring R] [inst_1 : AddCommGroup V] [inst_2 : Module R V]
[inst_3 : AddTorsor V P] [inst_4 : NeZero n] [Nontrivial R] {poly : Polygon P n},
Polygon.HasNondegenerateVertices R poly → poly.HasNondegenerateEdges
Polygons with nondegenerate vertices also have nondegenerate edges.
theorem Polygon.HasNondegenerateVertices.three_le E1 #
∀ {R : Type u_1} {V : Type u_2} {P : Type u_3} {n : ℕ} [inst : Ring R] [inst_1 : AddCommGroup V] [inst_2 : Module R V]
[inst_3 : AddTorsor V P] [inst_4 : NeZero n] [Nontrivial R] {poly : Polygon P n},
Polygon.HasNondegenerateVertices R poly → 3 ≤ n
def Affine.Triangle.toPolygon E1 #
{R : Type u_1} →
{V : Type u_2} →
{P : Type u_3} →
[inst : Ring R] →
[inst_1 : AddCommGroup V] → [inst_2 : Module R V] → [inst_3 : AddTorsor V P] → Affine.Triangle R P ↪ Polygon P 3
Embedding from affine triangles to polygons with 3 vertices.
theorem Affine.Triangle.toPolygon_vertices E0 #
∀ {R : Type u_1} {V : Type u_2} {P : Type u_3} [inst : Ring R] [inst_1 : AddCommGroup V] [inst_2 : Module R V]
[inst_3 : AddTorsor V P] (t : Affine.Triangle R P), (Affine.Triangle.toPolygon t).vertices = t.points
def Polygon.toTriangle E1 #
(R : Type u_1) →
{V : Type u_2} →
{P : Type u_3} →
[inst : Ring R] →
[inst_1 : AddCommGroup V] →
[inst_2 : Module R V] →
[inst_3 : AddTorsor V P] → (p : Polygon P 3) → Polygon.HasNondegenerateVertices R p → Affine.Triangle R P
Convert a polygon with 3 nondegenerate vertices to an Affine.Triangle.
theorem Polygon.toTriangle_points E0 #
∀ {R : Type u_1} {V : Type u_2} {P : Type u_3} [inst : Ring R] [inst_1 : AddCommGroup V] [inst_2 : Module R V]
[inst_3 : AddTorsor V P] (p : Polygon P 3) (h : Polygon.HasNondegenerateVertices R p),
(Polygon.toTriangle R p h).points = p.vertices
theorem Polygon.toTriangle_toPolygon E0 #
∀ {R : Type u_1} {V : Type u_2} {P : Type u_3} [inst : Ring R] [inst_1 : AddCommGroup V] [inst_2 : Module R V]
[inst_3 : AddTorsor V P] (poly : Polygon P 3) (h : Polygon.HasNondegenerateVertices R poly),
Affine.Triangle.toPolygon (Polygon.toTriangle R poly h) = poly
Converting a 3-polygon to a triangle and back yields the original polygon.
theorem Affine.Triangle.toPolygon_hasNondegenerateVertices E1 #
∀ {R : Type u_1} {V : Type u_2} {P : Type u_3} [inst : Ring R] [inst_1 : AddCommGroup V] [inst_2 : Module R V]
[inst_3 : AddTorsor V P] (t : Affine.Triangle R P), Polygon.HasNondegenerateVertices R (Affine.Triangle.toPolygon t)
The polygon obtained from a triangle has nondegenerate vertices.
theorem Affine.Triangle.toPolygon_toTriangle E0 #
∀ {R : Type u_1} {V : Type u_2} {P : Type u_3} [inst : Ring R] [inst_1 : AddCommGroup V] [inst_2 : Module R V]
[inst_3 : AddTorsor V P] (t : Affine.Triangle R P), Polygon.toTriangle R (Affine.Triangle.toPolygon t) ⋯ = t
Converting a triangle to a polygon and back yields the original triangle.