abstract class Tinman.Terrain.Shapes.ShapePolygonBase

Derived from

ShapeGeometry abstract

Extended by

ShapePolygonSimpleBase abstract

Abstract base class for IShape implementations that represent polygons.

Protected / Constructors


2 overloads

protected constructor ShapePolygonBase1 → (1)

serialId in : ISerialTypeInfo

The serial type ID.

Creates a new instance of ShapePolygonBase.

protected constructor ShapePolygonBase2 → (6)

serialId in : ISerialTypeInfo

The serial type ID.

negative in : bool

Polygon has negative parity?

vertices in : Vec2D [ ]

The shape vertices.

georef in : CoordinateSystem

Optional geo-reference.

metadata in : IJsonValue

Optional metadata.

values in : float64 [ ] [ ]

The custom per-vertex values that will be passed to ShapeGeometry.

Creates a new instance of ShapePolygonBase.

Protected / Methods


protected method DistanceTo → (5)

in : float64

X-coordinate of point.

in : float64

Y-coordinate of point.

distance in : float64

Absolute distance of point to polygon border (see remarks).

vertices in : Vec3I

The polygon contour segment that corresponds to distance in.

weights in : Vec3D

Relative vertex weights of vertices in.

returns → float64

The signed distance (negative is inside, positive is outside).

Computes the signed distance from the given point towards the polygon border.

The absolute distance from a point to the polygon border can be computed by using the Geometric.DistancePointToLineSegment2 method or by using a spatial quadtree of line segments (see SpatialQuadtree).

The weights in parameter is assumed to satisfy these assumptions:

weights.X >= weights.Y >= 0
weights.X + weights.Y = 1
weights.Z = 0

The vertices in parameter is interpreted as follows:

Distance to polygon vertex (weights.X = 1):
  vertices.X   := vertex index of point.
  vertices.Y/Z := index of previous/next contour vertex or negative if not
                  existent (if both are non-existent, use edge parity sign for

Distance to polygon edge (weights.X < 1):
  vertices.X/Y := index of nearest / farthest edge vertex
  vertices.Z   := The polygon edge direction, expressed with X and Y:
                  +1 : X->Y
                  -1 : Y->X
                   0 : X<>X (use edge parity sign for distance)

Protected / Attributes


protected attribute negative → (bool)

The polygon parity is negative?