TINMAN 3D / REALTIME TERRAIN
Software Development Kit - User Manual

class ShapeBuilder in Tinman.Terrain.Shapes

Abstract base class for building geometric shapes.

sealed class ShapeBuilder  

See also:

Shape.Geometry

Public / Attributes

Index

Returns the next vertex index.

public property Index { get }
type int32
value [>=0] The next vertex index.

See also:

Vertex

IndicesOriginal

Mapping from built shape vertex indices to original input vertex indices.

public property IndicesOriginal { get }
type int32[]
value The vertex index mapping of the most recently built shape or null.

Vertices

The list of vertices that have been specified.

public property Vertices { get }
type IArrayVector<Vec2D>
value [not-null] The vertex list.

Public / Constructors

Build

Creates a new instance of IShape from the specified vertices (see Vertex), edges (see Edge) and/or triangles (see Triangle).

public method Build (int32 edgeParity = 0)
type IShape
params edgeParity Edge parity to use. Defaults to 0.
returns The IShape object or null if the shape is empty.

Remarks:

This method only delegates to other method, in the following order:

  1. Mesh: when one or more triangles have been specified.
  2. Graph: when one or more edges have been specified and edgeParity is zero.
  3. Polygon: when one or more edges have been specified and edgeParity is not zero.
  4. Points: otherwise

Graph

Creates a new instance of IShape from the specified vertices (see Vertex) and edges (see Edge).

public method Graph ()
type IShape
returns The IShape object or null if the shape is empty.

Remarks:

All geometry data is cleared after the mesh has been built.

Hull

Creates a new instance of IShape that represents the convex hull of the specified vertices (see Vertex).

public method Hull ()
type IShape
returns The IShape object or null if the shape is empty.

Remarks:

The returned shape is a convex polygon that contains all specified vertices (the signed distance from the vertex to the shape is less than or equal to zero).

Mesh

Creates a new instance of IShape from the specified vertices (see Vertex) and triangles (see Triangle).

public method Mesh ()
type IShape
returns The IShape object or null if the shape is empty.

Remarks:

All geometry data is cleared after the mesh has been built.

Points

Creates a new instance of IShape from the specified vertices (see Vertex).

public method Points ()
type IShape
returns The IShape object or null if the shape is empty.

Remarks:

All geometry data is cleared after the mesh has been built.

Polygon

Creates a new instance of IShape from the specified vertices (see Vertex) and edges (see Edge).

public method Polygon (bool negative)
type IShape
params negative Shall the built polygon have a negative parity (EdgeParity)?
returns The IShape object or null if the shape is empty.

Remarks:

The specified edges

All geometry data is cleared after the mesh has been built.

Public / Methods

Add

Adds all vertices, edges and triangles of the given shape.

public method Add (IShape shape, bool flip = false)
type ShapeBuilder
params shape The shape.
  flip Flip edge resp. triangle vertices? Defaults to false.
returns [not-null] this

Remarks:

When flip is true, edges (A,B) resp. triangles (A,B,C) are added as (B,A) resp. (C,B,A).


Adds all vertices, edges and triangles of the given shape.

public method Add (IShape shape, bool flip, Mat3D matrix)
type ShapeBuilder
params shape The shape.
  flip Flip edge resp. triangle vertices? Defaults to false.
  matrix Homogeneous 2D transformation matrix to apply to the vertex coordinates of shape.
returns [not-null] this

Remarks:

When flip is true, edges (A,B) resp. triangles (A,B,C) are added as (B,A) resp. (C,B,A).

Edge

Specifies an edge when building a graph shape (see Graph) or polygon shape (see Polygon).

public method Edge (Vec2I edge)
type ShapeBuilder
params edge Indices of edge vertices.
returns [not-null] this

Specifies an edge when building a graph shape (see Graph) or polygon shape (see Polygon).

public method Edge (int32 a, int32 b)
type ShapeBuilder
params a Index of first edge vertex.
  b Index of second edge vertex.
returns [not-null] this

Edges

Specifies a sequence of connected edges (polyline) when building a graph shape (see Graph) or polygon shape (see Polygon).

public method Edges (bool closed = true)
type ShapeBuilder
params closed Connect last vertex to first one? Defaults to true.
returns [not-null] this

Remarks:

An edge is generated for each pair of consecutive vertices. When this method is called multiple times, edges are generated only for newly specified vertices.


Specifies a series of edges.

public method Edges (IArrayVector<Vec2I> edges)
type ShapeBuilder
params edges [not-null] The list of edges (from X to Y, each).
returns [not-null] this

Specifies a series of edges.

public method Edges (IVectorConst<Vec2I> edges)
type ShapeBuilder
params edges [not-null] The list of edges (from X to Y, each).
returns [not-null] this

Specifies a sequence of connected edges (polyline) when building a graph shape (see Graph) or polygon shape (see Polygon).

public method Edges (Vec2I edges, bool closed = true)
type ShapeBuilder
params edges Index of first (see X) resp. last (see Y) contour vertex.
  closed Connect last vertex to first one? Defaults to true.
returns [not-null] this

Remarks:

The vertex sequence can be reversed by swapping X and Y of edges.


Specifies a sequence of connected edges (polyline) when building a graph shape (see Graph) or polygon shape (see Polygon).

public method Edges (int32 a, int32 b, bool closed = true)
type ShapeBuilder
params a Index of first vertex.
  b Index of last vertex.
  closed Connect last vertex to first one? Defaults to true.
returns [not-null] this

Remarks:

The vertex sequence can be reversed by swapping a and b.


Specifies a series of edges.

public method Edges (Vec2I[] edges, int32 offset = 0, int32 count = -1)
type ShapeBuilder
params edges [not-null] The list of edges (from X to Y, each).
  offset [0..edges.Length] Offset into edges. Defaults to 0.
  count [-1..edges.Length-offset] Number of edges to read from edges. If -1, all remaining edges will be read. Defaults to -1.
returns [not-null] this

Georef

Specifies the coordinate system of the shape being built.

public method Georef (CoordinateSystem georef)
type ShapeBuilder
params georef The coordinate system or null.
returns [not-null] this

Rectangle

Specifies a rectangle.

public method Rectangle (float64 x0, float64 y0, float64 x1, float64 y1)
type ShapeBuilder
params x0 X-coordinate of first rectangle corner.
  y0 Y-coordinate of first rectangle corner.
  x1 X-coordinate of second rectangle corner.
  y1 Y-coordinate of second rectangle corner.
returns [not-null] this

Remarks:

This method calls Vertex in this order:

Then, the Edges method is called.

Transform

Applies the given coordinate transform while building shapes.

public method Transform (CoordinateSystemTransform transform, float64 accuracy = 0)
type ShapeBuilder
params transform [not-null] The coordinate system transformation to use.
  accuracy [>=0] Optional accuracy to use for subdivision of edges. Given as a maximum error in the target coordinate system (see Target). Set to 0 to disable edge subdivision. Defaults to 0.
returns [not-null] this

Remarks:

When a coordinate transform is given, the specified vertices are expected to be in the source coordinate system (see Source). The built shapes will have the target coordinate system as georeference (see Georef). So it is not necessary to call Georef when using a transform.

All existing geometry is cleared by this method.

Triangle

Specifies a triangle when building a mesh shape (see Mesh).

public method Triangle (Vec3I triangle)
type ShapeBuilder
params triangle Indices of triangle vertices.
returns [not-null] this

Specifies a triangle when building a mesh shape (see Mesh).

public method Triangle (int32 a, int32 b, int32 c)
type ShapeBuilder
params a Index of first triangle vertex.
  b Index of second triangle vertex.
  c Index of third triangle vertex.
returns [not-null] this

Vertex

Specifies a new vertex.

public method Vertex (Vec2D vertex)
type ShapeBuilder
params vertex The vertex coordinates.
returns [not-null] this

Specifies a new vertex.

public method Vertex (float64 x, float64 y)
type ShapeBuilder
params x X-coordinate of vertex.
  y Y-coordinate of vertex.
returns [not-null] this

VertexList

Specifies a series of vertices.

public method VertexList (IArrayVector<Vec2D> vertices)
type ShapeBuilder
params vertices [not-null] The list of vertices.
returns [not-null] this

Specifies a series of vertices.

public method VertexList (IVectorConst<Vec2D> vertices)
type ShapeBuilder
params vertices [not-null] The list of vertices.
returns [not-null] this

Specifies a series of vertices.

public method VertexList (Vec2D[] vertices, int32 offset = 0, int32 count = -1)
type ShapeBuilder
params vertices [not-null] The list of vertices.
  offset [0..vertices.Length] Offset into vertices. Defaults to 0.
  count [-1..vertices.Length-offset] Number of vertices to read from vertices. If -1, all remaining vertices will be read. Defaults to -1.
returns [not-null] this