differt.geometry package#

Submodules#

Module contents#

Geometries for building scenes.

class TriangleMesh(vertices, triangles)[source]#

Bases: Module

A simple geometry made of triangles.

Parameters:
  • vertices (Any) – The array of triangle vertices.

  • triangles (Any) – The array of triangle indices.

property diffraction_edges: UInt[Array, 'num_edges 3']#

The diffraction edges.

classmethod empty()[source]#

Create an empty scene.

Return type:

TriangleMesh

Returns:

A new empty scene.

property is_empty: bool#

Whether this scene has no triangle.

classmethod load_obj(file)[source]#

Load a triangle mesh from a Wavefront .obj file.

Currently, only vertices and triangles are loaded. Triangle normals are computed afterward (when first accessed).

Parameters:

file (str) – The path to the Wavefront .obj file.

Return type:

TriangleMesh

Returns:

The corresponding mesh containing only triangles.

classmethod load_ply(file)[source]#

Load a triangle mesh from a Stanford PLY .ply file.

Currently, only vertices and triangles are loaded. Triangle normals are computed afterward (when first accessed).

Parameters:

file (str) – The path to the Stanford PLY .ply file.

Return type:

TriangleMesh

Returns:

The corresponding mesh containing only triangles.

property normals: Float[Array, 'num_triangles 3']#

The triangle normals.

plot(**kwargs)[source]#

Plot this mesh on a 3D scene.

Parameters:

kwargs (Any) – Keyword arguments passed to draw_mesh.

Return type:

Any

Returns:

The resulting plot output.

triangles: UInt[Array, 'num_triangles 3']#

The array of triangle indices.

vertices: Float[Array, 'num_vertices 3']#

The array of triangle vertices.