digeo.Mesh#

class digeo.Mesh(vertices, faces, adjacencies=None, triangle_normals=None, v2t=None, vertex_normals=None, device='cpu', dtype=torch.float32)[source]#

Bases: object

Initialize a Mesh object with vertices, faces, and optional precomputed data.

Parameters:
  • vertices (NDArray | Tensor) – (V, 3) array of vertex positions.

  • faces (NDArray | Tensor) – (F, 3) array of triangle vertex indices.

  • adjacencies (Optional[NDArray | Tensor]) – (F, 3) stores the adjacent triangle indices for each triangle edge.

  • triangle_normals (Optional[NDArray | Tensor]) – (F, 3) array of triangle normal vectors.

  • v2t (Optional[NDArray | Tensor]) – (V, max_tris_per_vertex + 1) array mapping vertices to incident triangles. The first column stores the number of incident triangles, followed by the triangle indices.

  • vertex_normals (Optional[NDArray | Tensor]) – (V, 3) array of vertex normal vectors.

  • device (str | torch.device) – The device to store the mesh on.

  • dtype (torch.dtype) – The data type for the vertex positions and normals.

to(device: str | device) Mesh[source]#
to(dtype: dtype) Mesh
to(device: str | device, dtype: dtype) Mesh
to(tensor: Tensor) Mesh
to(*, device: str | device | None = ..., dtype: dtype | None = ...) Mesh

Move the mesh to a different device and/or dtype. Supports PyTorch-like overloads: - to(device) - to(dtype) - to(device, dtype) - to(device=…, dtype=…)

Return type:

Mesh