IShapeOps

Description

interface Tinman.Terrain.Shapes.IShapeOps

Extended by

IShape

Base interface that declares shape operations that can be performed on IShape objects.

Public / Methods

Absolute


public method Absolute → ()

returns → IShape

The transforming shape (i.e. deferred transformation is performed by the returned IShape object, not by this method).

Returns a shape that returns the absolute distance value (i.e. the outline of this shape).

This method modifies the distance field of the shape. No geometric processing is performed.

Compile


public method Compile → ()

returns → IShape

The resulting shape.

Compiles this shape into the most compact form.

The following data will not be modified by this method, i.e. the returned IShape object will return the same values as this object does:

The shape object structure may be modified. As a result, the following data may be different in the returned IShape object and this object:

Convert


public method Convert → (2)

type in : ShapeType

The shape type to convert to.

accuracy opt : float64 = 0

[>=0]
The accuracy value to use for the shape conversion (see remarks).

returns → IShape

The converted shape (i.e. the conversion is performed by this method). Will be null if the conversion is not possible (see remarks).

Converts this shape to the given type.

The following conversions are possible:

From, To | Implicit | Points | Graph | Polygon | Mesh | Group | Cube
---------+----------+--------+-------+---------+------+-------+-----
Implicit |      (1) |    n/a |   (2) |     n/a |  n/a |  (11) | (12)
---------+----------+--------+-------+---------+------+-------+-----
Points   |      n/a |    (1) |   n/a |     n/a |  (3) |  (11) | (12)
---------+----------+--------+-------+---------+------+-------+-----
Graph    |      n/a |    (4) |   (1) |     (5) |  (6) |  (11) | (12)
---------+----------+--------+-------+---------+------+-------+-----
Polygon  |      n/a |    (4) |   (7) |     (1) |  (8) |  (11) | (12)
---------+----------+--------+-------+---------+------+-------+-----
Mesh     |      n/a |    (4) |   (9) |    (10) |  (1) |  (11) | (12)
---------+----------+--------+-------+---------+------+-------+-----
Group    |     (13) |   (13) |  (13) |    (13) | (13) |   (1) | (12)
---------+----------+--------+-------+---------+------+-------+-----
Cube     |      n/a |    n/a |   n/a |     n/a |  n/a |  (11) |  (1)

These are the conversion methods:

  1. The conversion to the same type is a no-op, the method will return this.

  2. The signed distance field is traced in order to generate edges that approximate the contour at distance zero, using the accuracy opt.
    This conversion is not implemented yet and will return null!

  3. Treats the shape vertices as a point soup and computes a Delaunay triangulation for them, see Delaunay.

  4. The edges resp. triangles are discarded, the vertices are used as a point soup.

  5. First, all pairs of flipped edges (AB, BA) are dropped from the graph. Then, each island of connected edges in the graph must represent a polyline (closed or non-closed). Those will be interpreted as polygon contours.

  6. Each triplet of connected edges in the graph is interpreted as a triangle. All other edges are discarded.

  7. The polygon contour edges and vertices are used to build a graph.

  8. The polygon is triangulated using the Ear-Cutting algorithm.

  9. The triangle edges and vertices are used to build a graph.

  10. All triangle edges without an adjacent triangle are output as contour edges.

  11. The shape is wrapped in a shape group by delegating to the Group method.

  12. The shape is transformed to a cubemap by delegating to the TransformCubemap method, using the given accuracy opt.

  13. Each aggregated shape is converted with the Convert method, passing the given type in and accuracy opt values. The resulting shapes are returns as a new shape group.

The following conversions will round-trip without losing information:

See also

IShapeInfo.Type

Group


public method Group → ()

returns → IShape

The shape group.

Converts this shape into a shape group, if necessary.

If this shape is not of type ShapeType.Group, this method will first create a shape group with Shape.Group, passing the IShapeInfo.Georef value of this shape. Then, this shape will be added to the shape group with IShape.ShapeAdd.

Invert


public method Invert → ()

returns → IShape

The transforming shape (i.e. deferred transformation is performed by the returned IShape object, not by this method).

Inverts this shape.

This method modifies the distance field of the shape. No geometric processing is performed.

Maximum


public method Maximum → (1)

shape in : IShape

[not-null]
The other shape.

returns → IShape

The transforming shape (i.e. deferred transformation is performed by the returned IShape object, not by this method).

Returns a composite shape that returns the maximum distance value (i.e. intersection of this shape and the given one).

This method modifies the distance field of the shape. No geometric processing is performed.

Minimum


public method Minimum → (1)

shape in : IShape

[not-null]
The other shape.

returns → IShape

The transforming shape (i.e. deferred transformation is performed by the returned IShape object, not by this method).

Returns a composite shape that returns the minimum distance value (i.e. the union of this shape and the given one).

This method modifies the distance field of the shape. No geometric processing is performed.

Offset


public method Offset → (1)

offset in : float64

The distance offset to apply. Positive values will shrink the shape, negative values will grow it.

returns → IShape

The transforming shape (i.e. deferred transformation is performed by the returned IShape object, not by this method).

Applies a distance offset to this shape.

This method modifies the distance field of the shape. No geometric processing is performed.

Prepare​Lazy


public method PrepareLazy → ()

returns → IShape

this

Prepares all lazy-loaded resp. lazy-generated data for this shape.

IOException

If an I/O error has occurred while lazy-loading model data.

GeorefException

If the required geo-reference parameters are incomplete or invalid.

ValidatingException

If a validation error has occurred for the shape data or a shape reader object.

Transform​Coordinates


public method TransformCoordinates → (1)

matrix in : Mat3D

The 2D homogeneous matrix.

returns → IShape

The transforming shape (i.e. deferred transformation is performed by the returned IShape object, not by this method).

Transforms this shape using the given 2D homogeneous matrix.

Shape coordinates of this shape are multiplied with matrix in using Mat3D.Mul22 (with w = 1) in order to produce shape coordinates of the returned shape. Scalar distance field offsets of implicit shapes will be scaled, which will introduce spatial distortions if matrix in is not an affine transformation.

Transform​Coordinate​System


public method TransformCoordinateSystem → (2)

target in : CoordinateSystem

[not-null]
The target coordinate system.

accuracy opt : float64 = 0

[>=0]
Optional accuracy to use for subdivision of edges. Given as a maximum error in the target coordinate system (see target in. CoordinateSystem.HorizontalUnit). Set to 0 to disable edge subdivision.

returns → IShape

The transforming shape (i.e. deferred transformation is performed by the returned IShape object, not by this method).

Transforms this shape to the given coordinate system.

Transformation cannot be performed from resp. to a local coordinate system (see CoordinateSystem.IsLocal). A transformation between two local coordinate system is possible, but only a conversion regarding unit of measure (see CoordinateSystem.LocalUnit) and coordinate system flags (see CoordinateSystemFlags) is done.

Scalar distance field offsets of implicit shapes will be scaled, which will introduce spatial distortions of a scale that depends on how much the coordinate system transformation resembles an affine transformation (e.g. a simple unit conversion will not introduce any distortion).

Transform​Cubemap


public method TransformCubemap → (1)

accuracy opt : float64 = 0

[>=0]
Optional accuracy to use for subdivision of edges. Given as a maximum error in the target coordinate system (see CoordinateOperationMethod.Face). Set to 0 to disable edge subdivision.

returns → IShape

The transforming shape (i.e. deferred transformation is performed by the returned IShape object, not by this method).

Transforms this shape to a geographic cubemap coordinate system.

Scalar distance field offsets of implicit shapes will be scaled, which will introduce spatial distortions of a scale that depends on how much the coordinate system transformation resembles an affine transformation (e.g. a simple unit conversion will not introduce any distortion).

Depending on the location, the cubemap target coordinate system exhibits inherent distortions (skewed / non-orthogonal coordinate axes), which will cause distortions in the distance field. This should be taken into account when transforming implicit shapes.

Transform​Geometry


public method TransformGeometry → (4)

transform in : CoordinateSystemTransform

The coordinate system transformation to apply. May be null iff geocentric opt is not null; in this case, a transformation is created automatically.

accuracy opt : float64 = 0

[>=0]
Optional accuracy to use for subdivision of edges. Given as a maximum error in the target coordinate system (see CoordinateSystem.HorizontalUnit of CoordinateSystemTransform.Target of transform in. Set to 0 to disable edge subdivision.

geocentric opt : Geocentric = null

Depicts how to interpret the given accuracy opt:
null : maximum error in the target coordinate system (see (see CoordinateSystemTransform.Target)
non-null : maximum error in the given geocentric frame.

verticalType opt : VerticalType = VerticalType.Ellipsoid

If geocentric opt is non-null, specifies the vertical coordinate type to use for computing the maximum error in the geocentric frame.

returns → IShape

The transformed shape (i.e. the transformation is performed by this method). Will be null if the transformed shape is empty or if the transformation is not possible (see remarks).

Transforms this shape to the given coordinate system.

Transformation cannot be performed from resp. to a local coordinate system (see CoordinateSystem.IsLocal). A transformation between two local coordinate system is possible, but only a conversion regarding unit of measure (see CoordinateSystem.LocalUnit) and coordinate system flags (see CoordinateSystemFlags) is done.

If both transform in and geocentric opt are not null, the caller is responsible for making sure that the given transform in correlates with the source coordinate system (see IShapeInfo.Georef) and the target coordinate system (see Geocentric.Coordinates).

Transforming implicit shapes may introduce spatial distortions (see IShape).

Update

2 overloads


public method Update1 → (1)

georef in : CoordinateSystem

[not-null]
The new geo-reference.

returns → IShape

The resulting shape.

Replaces the geo-reference of this shape, without performing any transformation.


public method Update2 → (1)

metadata in : IJsonValue

[not-null]
The new metadata.

returns → IShape

The resulting shape.

Replaces the metadata of this shape.

Extensions

Outline


public static method Outline → (1)

width opt : float64 = 0

[>=0]
Width of outline shape.

returns → IShape

The transforming shape (i.e. deferred transformation is performed by the returned IShape object, not by this method).

Returns a shape that covers the outline of this shape.

This method modifies the distance field of the shape. No geometric processing is performed.