TetraMeshData#

class cherab.lhd.emc3.cython.TetraMeshData#

Bases: KDTree3DCore

Holds the 3D tetrahedral mesh data and acceleration structures.

This arrangement simplifies tetrahedral mesh instancing and the load/dump methods.

The mesh vertices are supplied as an Nx3 list/array of floating point values. For each Vertex, x, y and z coordinates must be supplied. e.g.

vertices = [[0.0, 0.0, 1.0], [1.0, 0.0, 0.0], …]

The tetrahedral array is an Mx4. Tetrahedra are defined by indexing i.e:

tetrahedra = [[v1, v2, v3, v4], …]

where v1, v2, v3, v4 are the vertex array indices specifying the tetrahedral vertices.

Parameters:
  • vertices (object) – A list/array or tetrahedral vertices with shape Nx3, where N is the number of vertices.

  • tetrahedra (object) – A list/array of tetrahedra with shape Mx4, where M is the number of tetrahedra in the mesh. For each tetrahedra there must be four integers identifying the tetrahedral vertices in the vertices array.

  • tolerant (bool) – Toggles filtering out of degenerate tetrahedra (default=True).

Variables:
  • vertices (ndarray) – tetrahedral vertices with shape Nx3, where N is the number of vertices.

  • tetrahedra (ndarray) – tetrahedra with shape Mx4, where M is the number of tetrahedra in the mesh.

Methods

barycenter(index)

Returns the barycenter point of the specified tetrahedron.

bounding_box(to_world)

Returns a bounding box that encloses the mesh.

from_file(file)

Load a mesh with its kd-Tree representation from Raysect mesh binary file (.rsm).

is_contained(point)

Traverses the kd-Tree to identify if the point is contained by an item.

items_containing

Starts contains traversal of the kd-Tree.

load(file)

Load a mesh with its kd-Tree representation from Raysect mesh binary file (.rsm).

save(file)

Save the mesh's kd-Tree representation to a binary Raysect mesh file (.rsm).

tetrahedron(index)

Returns the specified tetrahedron.

trace

Traverses the kd-Tree to find the first intersection with an item stored in the tree.

vertex(index)

Returns the specified vertex.

volume(index)

Calculate a volume of the specified tetrahedron

volume_total()

Calculate a total volume of all tetrahedra

Attributes