compas_cgal.trimesh.TriMesh

class compas_cgal.trimesh.TriMesh(vertices, faces)[source]

Bases: object

Class representing a triangle mesh with its vertices and faces stored as Numpy arrays.

Parameters
  • vertices (array-like) – The vertices of the mesh.

  • faces (array-like) – The faces of the mesh.

Attributes
  • vertices (ndarray[(n, 3), float64]) – The vertices of the mesh stored as a n by 3 Numpy array of floats, with n the number of vertices.

  • faces (ndarray[(f, 3), int32]) – The faces of the mesh stored as a f by 3 Numpy array of integers, with f the number of faces.

  • edges (list of tuple(int, int) - readonly) – Edges of the mesh as pairs of vertices.

  • adjacency (dict - readonly) – Vertex adjacency dict.

  • C (sp.sparse.csr_matrix - readonly) – Sparse connectivity matrix.

  • A (sp.sparse.csr_matrix - readonly) – Sparse adjacency matrix.

  • D (sp.sparse.csr_matrix - readonly) – Sparse degree matrix.

  • centroid (ndarray[(1, 3), float64] - readonly) – The centroid of the mesh.

  • average_edge_length (float - readonly) – The average length og the edges.

__init__(vertices, faces)[source]

Initialize self. See help(type(self)) for accurate signature.

Methods

copy()

Create an independent copy of the triangle mesh.

cull_vertices()

Remove unused vertices.

from_mesh(mesh)

Construct a triangle mesh from a COMPAS mesh.

from_off(filepath[, precision])

Construct a triangle mesh from the data in an OFF file.

from_ply(filepath[, precision])

Construct a triangle mesh from the data in a PLY file.

from_stl(filepath[, precision])

Construct a triangle mesh from the data in an STL file.

remesh(target_length[, iterations])

Remesh the triangle mesh.

to_mesh()

Convert the triangle mesh to a COMPAS mesh

transform(T)

Transform the triangle mesh.

transformed(T)

Create a transformed copy of the triangle mesh.

Attributes

A

C

D

adjacency

average_edge_length

centroid

edges

faces

vertices