IShape
Description
- Derived from
- Extended by
-
IShapeGroup
ShapeBase abstract
Base interface for geometric two-dimensional shapes that are defined by a distance field.
Shapes can be defined implicitly. In this case, IShapeInfo.VertexCount returns zero and the implementation class is responsible for computing a proper distance field. Explicit shape definitions make use of vertices (see VertexAt), edges (EdgeAt) and triangles (TriangleAt). Edges can also be used to define polygon contours (see EdgeWalk and IShapeInfo.EdgeParity). To built an explicit shape, use Shape.Geometry.
shape type | vertex | edge | triangle | edge | count | count | count | parity -----------+----------+----------+----------+------- Implicit | 0 | 0 | 0 | 0 -----------+----------+----------+----------+------- Points | > 0 | 0 | 0 | 0 -----------+----------+----------+----------+------- Graph | > 0 | > 0 | 0 | 0 -----------+----------+----------+----------+------- Polygon | > 0 | > 0 | 0 | != 0 -----------+----------+----------+----------+------- Mesh | > 0 | 0 | > 0 | 0
All other combinations are invalid, see ShapeType.
A polygon is made up of one or more contours, where each contour is a connected sequence of non-intersecting edges. Polygon contours are defined piecewise by the set of edges (see EdgeAt). A contour can either be an outer ring or a hole, depending on the winding of its vertices.
In order to test whether a point p
lies in the inside or outside half-space of a contour edge between two vertices v0
and v1
, the Geometric.Winding1 method can be used:
w := Winding(v0, v1, p) inside := w == Parity outside := w != Parity where w != 0
Usually, contours will be closed. Open contours can occur during transformation of shapes from one coordinate system to another (see IShapeOps.TransformCoordinateSystem or IShapeOps.TransformCubemap) for vertex coordinates which are not defined in the target coordinate system.
Public / Methods
ContourStart
Computes the contours of this polygon shape.
This method will not perform any geometric processing. Instead, it simply uses IShapeInfo.EdgeCount, EdgeAt and EdgeWalk in order to find the polygon contours.
DistanceTo
2 overloads
Computes the smallest distance from the given point to the shape, additionally returning the corresponding nearest feature point on the shape.
If the point lies outside of the shape, the returned distance will be greater than zero. If the point is inside of the shape, the returned distance will be negative. The returned distance will be zero if the point exactly lies on the shape boundary.
Computes the smallest distance from the given point to the shape.
If the point lies outside of the shape, the returned distance will be greater than zero. If the point is inside of the shape, the returned distance will be negative. The returned distance will be zero if the point exactly lies on the shape boundary.
Face
Returns the shape on the given cubemap face.
Passing CubemapFace.NegZ to an ordinary shape will return this
. Cubemap shapes (see IShapeOps.TransformCubemap) will return an aggregated shape for each cubemap face, or null
.
Cubemap shapes are used by IHeightmapShape and IPixelPyramidShape objects.
Public / Attributes
Bounds
Returns the axis-aligned bounding box of this shape.
The bounding box is defined as the smallest possible rectangle that contains all points which have a shape distance of zero or less.
IsGeometry
Does this shape consist of plain geometry only?
Shapes with plain geometry can be rebuilt via Shape.Geometry.
Extensions
Contains
2 overloads
Checks if this shape contains the given geographic coordinates.
Checks if this shape contains the given geographic coordinates.
Contours
Computes the vertices of each contour of this polygon shape.
The returned array may be accessed as follows:
contours[N][M] := vertex index
where N
is the contour index and M
is the vertex index in the contour.
ContourVertices
Computes the vertices on the given polygon contour.
The first and the last vertex will be the same iff the polygon contour is closed.
DistanceTo
Computes the shortest distance from the given point to the shape.
If the point lies outside of the shape, the returned distance will be greater than zero. If the point is inside of the shape, the returned distance will be negative. The returned distance will be zero if the point exactly lies on the shape boundary.
ImportCSH
Imports this shape into a CSH
file (Compressed SHape).
The returned IOperation object will use the WriteCSH method to write the actual file contents.
WriteCSH
Writes this shape to a CSH
file (Compressed SHape).
- IOException
-
If an I/O error has occurred.
- See also