BoxSoup

Description

sealed class Tinman.Terrain.Util.BoxSoup

The BoxSoup represents a soup of 3D boxes in terrain-space.

The box soup is populated with the Add methods. Call Clear to remove all boxes. Clipping against arbitrary planes in terrain-space is done with the Clip method.

Use Vertices, Edges and Faces to visualize the box soup, for example the bounding boxes of all terrain mesh sectors in the view-frustum.

Use Points to obtain a point soup of all clipped boxes. This can be used to create fitted convex hulls, for example.

Public / Constructors

Box​Soup


public constructor BoxSoup → ()

Creates a new instance of BoxSoup.

Public / Methods

Add

4 overloads


public method Add1 → (1)

box in : Box3D

The box to add.

Adds an axis-aligned box to this soup.


public method Add2 → (2)

box in : Box3D

The axis-aligned box to add.

transform in : AffineTransform

The transformation to apply to box in before adding it to this soup.

Adds a box to this soup.


public method Add3 → (1)

box in : Cuboid

The box to add.

Adds a box to this soup.


public method Add4 → (8)

v000 in : Vec3D

Box corner vertex.

v001 in : Vec3D

Box corner vertex.

v010 in : Vec3D

Box corner vertex.

v011 in : Vec3D

Box corner vertex.

v100 in : Vec3D

Box corner vertex.

v101 in : Vec3D

Box corner vertex.

v110 in : Vec3D

Box corner vertex.

v111 in : Vec3D

Box corner vertex.

Adds a box to this soup.

Clear


public method Clear → ()

Removes all boxes from this soup.

Clip


public method Clip → (1)

plane in : Plane

The plane, in terrain-space.

Clips all boxes in this soup at the given plane.

This BoxSoup will be intersected with the positive half-space of the given plane.

Set


public method Set → (1)

other in : BoxSoup

[not-null]
The box soup to set to.

Sets this box soup the given one.

Public / Attributes

Bounds


public attribute Bounds → (get,set)

value : Box3D

The world bounds or Box3D.Max to disable box clipping.

Optional world bounds.

Add given boxes are clipped to these bounds.

Edges


public attribute Edges → (get)

value : IArrayVector<Vec2I>

[not-null]
The box soup edges, as a list of line segments.

Returns the edges of the clipped box soup.

The returned indices refer to the box soup vertices (see Vertices).

Faces


public attribute Faces → (get)

value : IArrayVector<Vec3I>

[not-null]
The box soup faces, as a list of triangles.

Returns the faces of the clipped box soup.

The returned indices refer to the box soup vertices (see Vertices).

Points


public attribute Points → (get)

value : IArrayVector<Vec3D>

[not-null]
The list of points.

Returns the points of the clipped box soup.

Vertices


public attribute Vertices → (get)

value : IArrayVector<Vec3D>

[not-null]
The list of vertices, in terrain-space.

Returns the vertices of the box soup.