Shape

Description

Base interface for geometric two-dimensional shapes that are defined by a distance field.

Shapes may be defined implicitly. In this case, the implementation class is responsible for computing the signed distance field, using arbitrary arithmetic. Explicit shape definitions on the other hand make use of vertices, edges and triangles to define the signed distance field with standard arithmetic (i.e. distance to point, distance to line segment, distance to triangle). To build an explicit shape, use Geometry.

Polygons are defined by one or more contours, where each contour is a connected sequence of edges. Polygon contours do not intersect (but may share common edges) and will either be an outer ring or an inner ring (i.e. a hole), depending on the winding of its vertices (see Shape.Info.parity).

Shapes may aggregate other shapes, optionally exposing all or some of the aggregated shape vertices as well. Cubemap shapes contain up to six aggregated shapes, one for each cubemap face, having special a geo-reference (see CoordOp.Type.Cubemap_Face).

The following table illustrates the different shape types and their relation to aggregated shapes and contained vertices / edges / triangles:

Shape    | Shape  | Vertex |  Edge  |  Edge  |Triangle
Type     | Count  | Count  | Count  | Parity | Count
---------+--------+--------+--------+--------+--------
Implicit |  >= 0  |  >= 0  |   = 0  |   = 0  |   = 0
---------+--------+--------+--------+--------+--------
Group    |  >= 0  |  >= 0  |   = 0  |   = 0  |   = 0
---------+--------+--------+--------+--------+--------
Cubemap  |  0..6  |   = 0  |   = 0  |   = 0  |   = 0
---------+--------+--------+--------+--------+--------
Points   |  >= 0  |   > 0  |   = 0  |   = 0  |   = 0
---------+--------+--------+--------+--------+--------
Graph    |  >= 0  |   > 0  |   > 0  |   = 0  |   = 0
---------+--------+--------+--------+--------+--------
Polygon  |  >= 0  |   > 0  |   > 0  |  != 0  |   = 0
---------+--------+--------+--------+--------+--------
Mesh     |  >= 0  |   > 0  |   = 0  |   = 0  |   > 0

All other combinations are invalid, see Shape.Type.

Usually, contours will be closed. Open contours can occur during transformation of shapes from one coordinate system to another (see Shape.Georef) for vertex coordinates which are not defined in the target coordinate system.