scenic.core.geometry

Utility functions for geometric computation.

Summary of Module Members

Functions

allChains

apparentHeadingAtPoint

averageVectors

cleanChain

cleanPolygon

cos

distanceToLine

findMinMax

headingOfSegment

hypot

max

min

normalizeAngle

plotPolygon

pointIsInCone

polygonUnion

removeHoles

rotateVector

sin

splitSelfIntersections

triangulatePolygon

Triangulate the given Shapely polygon.

triangulatePolygon_mapbox

viewAngleToPoint

Exceptions

TriangulationError

Signals that the installed triangulation libraries are insufficient.

Member Details

exception TriangulationError[source]

Bases: RuntimeError

Signals that the installed triangulation libraries are insufficient.

triangulatePolygon(polygon)[source]

Triangulate the given Shapely polygon.

Note that we can’t use shapely.ops.triangulate since it triangulates point sets, not polygons (i.e., it doesn’t respect edges). We need an algorithm for triangulation of polygons with holes (it doesn’t need to be a Delaunay triangulation).

Parameters:

polygon (shapely.geometry.Polygon) – Polygon to triangulate.

Returns:

A list of disjoint (except for edges) triangles whose union is the original polygon.