scenic.core.geometry¶
Utility functions for geometric computation.
Summary of Module Members¶
Functions
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Triangulate the given Shapely polygon. |
|
|
|
|
|
|
Classes
mixin providing collision detection for rectangular objects and regions |
Exceptions
Signals that the installed triangulation libraries are insufficient. |
Member Details¶
-
givePP2TWarning
= True¶ Whether to warn when falling back to pypoly2tri for triangulation
-
exception
TriangulationError
[source]¶ Bases:
RuntimeError
Signals that the installed triangulation libraries are insufficient.
Specifically, raised when pypoly2tri hits the recursion limit trying to triangulate a large polygon.
-
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).We currently use the GPC library (wrapped by the
Polygon3
package) if it is installed. Since it is not free for commercial use, we don’t require it as a dependency, falling back on the BSD-compatiblepypoly2tri
as needed. In this case we issue a warning, since GPC is more robust and handles large polygons. The warning can be disabled by settinggivePP2TWarning
toFalse
.- Parameters
polygon (shapely.geometry.Polygon) – Polygon to triangulate.
- Returns
A list of disjoint (except for edges) triangles whose union is the original polygon.