sealed class Tinman.Engine.Components.Silhouette

Computes silhouette edges for a given view direction or view point of a soup of loosely connected triangular faces.

To build a silhouette, perform the following steps:

  1. Create a new instance of Silhouette.

  2. Add triangular faces with Face, which populates Edges, Faces and Vertices.

  3. Optionally call Finish, to free the internal data structures for face specification.

  4. Optionally call Prepare, to warm up the spatial acceleration data structures.

  5. Call Compute (repeatedly) to build the silhouette edges, see Contour.

  6. To start from scratch, call Clear and go to to step 2.

Public / Constructors


public constructor Silhouette → ()

Creates a new instance of Silhouette.

Public / Methods


public method Clear → ()

Clears the silhouette by deleting all vertices and faces.


public method Compute → (1)

vector in : Vec4D

The unit-length view direction vector (if Vec4D.W is 0) or the point of view (if Vec4D.W is not 0).

Computes the silhouette for the given vector.

This method (re-)builds the whole content of Contour.


public method Edge → (2)

in : Vec3D

Coordinates of first edge point.

in : Vec3D

Coordinates of second edge point.

Specifies a single edge.

Edges that are not connected to at least one face will always be included in Contour.


public method Face → (3)

in : Vec3D

Coordinates of first triangle point.

in : Vec3D

Coordinates of second triangle point.

in : Vec3D

Coordinates of third triangle point.

Specifies a triangular face.

First, the given points in, in, in are mapped to unique vertices, which may add new elements to Vertices. Then, the vertex indices are used to build one face tuple and three edge tuples, which may add new elements to Faces resp. Edges. Finally, the front-facing normal-vector of the triangle is computed as follows:

normal = cross(b - a, c - a)


public method Finish → ()

Finishes specification of faces via Face.

After this method has been called, no more faces can be added; Face will return silently. The Clear method will undo this. Finishing face specification allows to free internal data structures that are no longer needed.


public method Prepare → ()

Computes all spatial acceleration data structures, if necessary.

Adding new faces via Face will invalidate the data structures. When the Compute method is called, the computations will be performed automatically. Calling this method is optional, but will make sure that all computations will have been performed when Compute is called.


public method ToModelGeometry → (2)

builder in : ModelGeometryBuilder

The model geometry builder to feed.

which in : int32

Bitmask that chooses which data to feed to builder in:
1 : Vertices using VertexWriter.P2
2 : Faces using ModelGeometryBuilder.Triangle
4 : Edges using ModelGeometryBuilder.LineSegment
8 : Contour using ModelGeometryBuilder.LineSegment
Vertices are output before faces, faces are output before edges, edges are output before contours.

returns → Vec4I

The amount of geometry that has been fed to builder in:
Vec4I.X : the vertex count
Vec4I.Y : the index count for faces
Vec4I.Z : the index count for edges
Vec4I.W : the index count for contours

Feeds vertex, edge and/or contour data into the given model geometry builder.

Public / Attributes


public attribute Contour → (get)

value : IArrayVector<int32>

The edge array. Each element refers to a unique edge in Edges.

The silhouette edges that have been computed with Compute


public attribute Edges → (get)

value : IArrayVector<Vec2I>

The edge array.

The unique edges that have been added with Face.

Adjacent edges of different faces produce only one unique edge. The Vec2I.X and Vec2I.Y indices depict the edge vertices (see Vertices), where Vec2I.X is always smaller than Vec2I.Y.


public attribute Faces → (get)

value : IArrayVector<Vec3I>

The face array.

The unique faces that have been added with Face.

Each Vec3I value depicts three vertices in Vertices which span the triangular face, where Vec3I.X is always smaller than both Vec3I.Y and Vec3I.Z.


public attribute Transform → (get,set)

value : AffineTransform

The transformation to apply.

The transformation that is applied to the vertex points that are passed to Edge and Face.


public attribute Vertices → (get)

value : IArrayVector<Vec3D>

The vertex array.

The unique vertices that have been added with Face.

Adding points with identical coordinates will create only a single unique vertex.