Mesh

class pmeshlab.Mesh
__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: pmeshlab.Mesh, vertex_matrix: numpy.ndarray[numpy.float64[m, 3]] = array([], shape=(0, 3), dtype=float64), face_matrix: numpy.ndarray[numpy.int32[m, 3]] = array([], shape=(0, 3), dtype=int32), edge_matrix: numpy.ndarray[numpy.int32[m, 2]] = array([], shape=(0, 2), dtype=int32), v_normals_matrix: numpy.ndarray[numpy.float64[m, 3]] = array([], shape=(0, 3), dtype=float64), f_normals_matrix: numpy.ndarray[numpy.float64[m, 3]] = array([], shape=(0, 3), dtype=float64), v_scalar_array: numpy.ndarray[numpy.float64[m, 1]] = array([], dtype=float64), f_scalar_array: numpy.ndarray[numpy.float64[m, 1]] = array([], dtype=float64), v_color_matrix: numpy.ndarray[numpy.float64[m, 4]] = array([], shape=(0, 4), dtype=float64), f_color_matrix: numpy.ndarray[numpy.float64[m, 4]] = array([], shape=(0, 4), dtype=float64), v_tex_coords_matrix: numpy.ndarray[numpy.float64[m, 2]] = array([], shape=(0, 2), dtype=float64), w_tex_coords_matrix: numpy.ndarray[numpy.float64[m, 2]] = array([], shape=(0, 2), dtype=float64)) -> None

Creates a mesh containing the data passed as input. If no data is passed as argument, an empty mesh will be created. Color matrices have four columns (RGBA) and values are floats in the range [0-1]. Values outside this range will result in undefined behaviour. Wedge texture coordinates must be a matrix of NF*3 rows ant two columns (a texture coordinate for each edge of each triangle of the mesh).

  1. __init__(self: pmeshlab.Mesh, vertex_matrix: numpy.ndarray[numpy.float64[m, 3]], face_list_of_indices: List[numpy.ndarray[numpy.uint32[m, 1]]], v_normals_matrix: numpy.ndarray[numpy.float64[m, 3]] = array([], shape=(0, 3), dtype=float64), f_normals_matrix: numpy.ndarray[numpy.float64[m, 3]] = array([], shape=(0, 3), dtype=float64), v_scalar_array: numpy.ndarray[numpy.float64[m, 1]] = array([], dtype=float64), f_scalar_array: numpy.ndarray[numpy.float64[m, 1]] = array([], dtype=float64), v_color_matrix: numpy.ndarray[numpy.float64[m, 4]] = array([], shape=(0, 4), dtype=float64), f_color_matrix: numpy.ndarray[numpy.float64[m, 4]] = array([], shape=(0, 4), dtype=float64), v_tex_coords_matrix: numpy.ndarray[numpy.float64[m, 2]] = array([], shape=(0, 2), dtype=float64)) -> None

Creates a polygon mesh containing the data passed as input. At least a numpy array of vertices and a list of numpy arrays of face indices is required. Since MeshLab and PyMeshLab can store only triangle meshes, the newly created mesh is actually a triangle mesh with some edges that are marked as ‘faux’. This constructor creates a custom per face scalar attribute called poly_birth_faces that stores, for each face of the newly created mesh, the index of the polygonal mesh that generated it.Color matrices have four columns (RGBA) and values are floats in the range [0-1]. Values outside this range will result in undefined behaviour.

add_face_custom_point_attribute(self: pmeshlab.Mesh, attribute_values: numpy.ndarray[numpy.float64[m, 3]], attribute_name: str) None

Adds a new user defined 3D point attribute associated to the faces of the mesh. Takes as input numpy array of vectors having 3 columns and the number of rows equal to the number of faces of the mesh, and the name of the new attribute. Raises a MissingCompactnessException if the mesh is not compact. Raises a PyMeshLabException if the given array has not the correct sizes, or if the mesh already contains a face vector attribute with the given name.

add_face_custom_scalar_attribute(self: pmeshlab.Mesh, attribute_values: numpy.ndarray[numpy.float64[m, 1]], attribute_name: str) None

Adds a new user defined scalar attribute associated to the faces of the mesh. Takes as input numpy array of scalar having the same size of the number of faces of the mesh, and the name of the new attribute. Raises a MissingCompactnessException if the mesh is not compact. Raises a PyMeshLabException if the given array has a different size from the face number of the mesh, or if the mesh already contains a face scalar attribute with the given name.

add_vertex_custom_point_attribute(self: pmeshlab.Mesh, attribute_values: numpy.ndarray[numpy.float64[m, 3]], attribute_name: str) None

Adds a new user defined 3D point attribute associated to the vertices of the mesh. Takes as input numpy array of vectors having 3 columns and the number of rows equal to the number of vertices of the mesh, and the name of the new attribute. Raises a MissingCompactnessException if the mesh is not compact. Raises a PyMeshLabException if the given array has not the correct sizes, or if the mesh already contains a vertex vector attribute with the given name.

add_vertex_custom_scalar_attribute(self: pmeshlab.Mesh, attribute_values: numpy.ndarray[numpy.float64[m, 1]], attribute_name: str) None

Adds a new user defined scalar attribute associated to the vertices of the mesh. Takes as input numpy array of scalar having the same size of the number of vertices of the mesh, and the name of the new attribute. Raises a MissingCompactnessException if the mesh is not compact. Raises a PyMeshLabException if the given array has a different size from the vertex number of the mesh, or if the mesh already contains a vertex scalar attribute with the given name.

bounding_box(self: pmeshlab.Mesh) pmeshlab.BoundingBox

Returns the bounding box of the mesh.

compact(self: pmeshlab.Mesh) None

Compacts all the arrays of the mesh.

edge_matrix(self: pmeshlab.Mesh) numpy.ndarray[numpy.int32[m, 2]]

Returns the edge matrix of the mesh as a numpy array, which is a #E*2 matrix of vertex indices. Raises a MissingCompactnessException if the mesh is not compact. Note: The Edge Matrix, in VCGLib, MeshLab and PyMeshLab is not related and has nothing to do withthe Mesh Faces. Edges are used to store polylines or simple collections of edges that are unrelated with faces. Some filters that generate Edges in PyMeshLab are generate_polyline_from_planar_section and generate_polyline_from_selection_perimeter.

edge_number(self: pmeshlab.Mesh) int

Returns the number of edges of the mesh.

face_color_array(self: pmeshlab.Mesh) numpy.ndarray[numpy.uint32[m, 1]]

Returns the face color array as a numpy array, which is a #F array of unsigned integers, each value is the ARGB packed in a 32bit unsigned int (8 bits per component). Raises a MissingCompactnessException if the mesh is not compact. Raises a MissingComponentException if the mesh has no face color component.

face_color_matrix(self: pmeshlab.Mesh) numpy.ndarray[numpy.float64[m, 4]]

Returns the face color matrix as a numpy array, which is a #V*4 matrix of floats, each component (RGBA) is in the interval [0, 1]. Raises a MissingCompactnessException if the mesh is not compact. Raises a MissingComponentException if the mesh has no face color component.

face_curvature_principal_dir1_matrix(self: pmeshlab.Mesh) numpy.ndarray[numpy.float64[m, 3]]

Returns the face curvature - principal direction 1 matrix of the mesh as a numpy array. Raises a MissingCompactnessException if the mesh is not compact. Raises a MissingComponentException if the mesh has no face curvature component.

face_curvature_principal_dir2_matrix(self: pmeshlab.Mesh) numpy.ndarray[numpy.float64[m, 3]]

Returns the face curvature - principal direction 2 matrix of the mesh as a numpy array. Raises a MissingCompactnessException if the mesh is not compact. Raises a MissingComponentException if the mesh has no face curvature component.

face_custom_point_attribute_matrix(self: pmeshlab.Mesh, arg0: str) numpy.ndarray[numpy.float64[m, 3]]

Returns a numpy matrix containing the 3D point values of the given user defined attribute name associated to the faces of the mesh. Raises a MissingCompactnessException if the mesh is not compact. Raises a PyMeshLabException if the given name does not represent a face vector attribute in the mesh.

face_custom_scalar_attribute_array(self: pmeshlab.Mesh, arg0: str) numpy.ndarray[numpy.float64[m, 1]]

Returns a numpy array containing the scalar values of the given user defined attribute name associated to the faces of the mesh. Raises a MissingCompactnessException if the mesh is not compact. Raises a PyMeshLabException if the given name does not represent a face scalar attribute in the mesh.

face_face_adjacency_matrix(self: pmeshlab.Mesh) numpy.ndarray[numpy.int32[m, 3]]

Returns face-to-face adjacency matrix of the mesh as a numpy array. Raises a MissingCompactnessException if the mesh is not compact. Raises a MissingComponentException if the mesh has no face-to-face adjacency component.

face_matrix(self: pmeshlab.Mesh) numpy.ndarray[numpy.int32[m, 3]]

Returns the face matrix of the mesh as a numpy array, which is a #F*3 matrix of vertex indices. Raises a MissingCompactnessException if the mesh is not compact.

face_normal_matrix(self: pmeshlab.Mesh) numpy.ndarray[numpy.float64[m, 3]]

Returns the face normal matrix of the mesh as a numpy array, which is a #F*3 matrix of face normals. Raises a MissingCompactnessException if the mesh is not compact.

face_number(self: pmeshlab.Mesh) int

Returns the number of faces of the mesh.

face_scalar_array(self: pmeshlab.Mesh) numpy.ndarray[numpy.float64[m, 1]]

Returns the face scalar array of the mesh as a numpy array, which is a #F array of floats. Raises a MissingCompactnessException if the mesh is not compact. Raises a MissingComponentException if the mesh has no face quality component.

face_selection_array(self: pmeshlab.Mesh) numpy.ndarray[bool[m, 1]]

Returns the face selection array of the mesh as a numpy array,which is a #F array of booleans (true if the corresponding face is selected, false otherwise). Raises a MissingCompactnessException if the mesh is not compact.

has_face_color(self: pmeshlab.Mesh) bool

Returns true if the mesh has the face color component, false otherwise.

has_face_scalar(self: pmeshlab.Mesh) bool

Returns true if the mesh has the face scalar component, false otherwise.

has_vertex_color(self: pmeshlab.Mesh) bool

Returns true if the mesh has the vertex color component, false otherwise.

has_vertex_scalar(self: pmeshlab.Mesh) bool

Returns true if the mesh has the vertex scalar component, false otherwise.

has_vertex_tex_coord(self: pmeshlab.Mesh) bool

Returns true if the mesh has the vertex texture coordinate component, false otherwise.

has_wedge_tex_coord(self: pmeshlab.Mesh) bool

Returns true if the mesh has the wedge texture coordinate component, false otherwise.

id(self: pmeshlab.Mesh) int

Returns the id of the mesh into a MeshSet. If the Mesh is not part of a MeshSet, the returned value is -1.

is_compact(self: pmeshlab.Mesh) bool

Returns true if all its arrays are compact.

is_point_cloud(self: pmeshlab.Mesh) bool

Returns true if the mesh has no faces (it is a point cloud)

is_visible(self: pmeshlab.Mesh) bool

Returns a boolean indicating whether the mesh is marked as visible or not.

label(self: pmeshlab.Mesh) str

Returns a the label associated to the Mesh.

polygonal_face_list(self: pmeshlab.Mesh) List[numpy.ndarray[numpy.uint32[m, 1]]]

Returns a list of numpy arrays. Each numpy array contains the vertex indices composing the ith polygonal face. Raises a MissingCompactnessException if the mesh is not compact.

selected_face_number(self: pmeshlab.Mesh) int

Returns the number of selected faces of the mesh.

selected_vertex_number(self: pmeshlab.Mesh) int

Returns the number of selected vertices of the mesh.

set_label(self: pmeshlab.Mesh, arg0: str) None

Sets the label associated to the mesh.

texture(*args, **kwargs)

Overloaded function.

  1. texture(self: pmeshlab.Mesh, arg0: int) -> pmeshlab.Image

Returns the texture of the Mesh at the given index.

  1. texture(self: pmeshlab.Mesh, arg0: str) -> pmeshlab.Image

Returns the texture of the Mesh with the given name.

texture_number(self: pmeshlab.Mesh) int

Returns the number of textures contained in the mesh.

textures(self: pmeshlab.Mesh) Dict[str, pmeshlab.Image]

Returns a dictionary with the texture names as keys and the texture images of the mesh as values.

transform_matrix(self: pmeshlab.Mesh) numpy.ndarray[numpy.float64[4, 4]]

Returns the 4x4 transform matrix associated to the mesh.

transformed_vertex_matrix(self: pmeshlab.Mesh) numpy.ndarray[numpy.float64[m, 3]]

Returns the vertex matrix of the mesh as a numpy array, which is a #V*3 matrix of vertex coordinates. Coordinates are transformed w.r.t. the transformation matrix of the mesh. Raises a MissingCompactnessException if the mesh is not compact.

update_bounding_box(self: pmeshlab.Mesh) None

Updates the bounding box of the mesh.

update_topology(self: pmeshlab.Mesh) None

Updates the topology of the mesh.

vertex_color_array(self: pmeshlab.Mesh) numpy.ndarray[numpy.uint32[m, 1]]

Returns the vertex color array as a numpy array, which is a #V array of unsigned integers, each value is the ARGB packed in a 32bit unsigned int (8 bits per component).Raises a MissingCompactnessException if the mesh is not compact.

vertex_color_matrix(self: pmeshlab.Mesh) numpy.ndarray[numpy.float64[m, 4]]

Returns the vertex color matrix as a numpy array, which is a #V*4 matrix of floats, each component (RGBA) is in the interval [0, 1]. Raises a MissingCompactnessException if the mesh is not compact.

vertex_curvature_principal_dir1_matrix(self: pmeshlab.Mesh) numpy.ndarray[numpy.float64[m, 3]]

Returns the vertex curvature - principal direction 1 matrix of the mesh as a numpy array. Raises a MissingCompactnessException if the mesh is not compact. Raises a MissingComponentException if the mesh has no vertex curvature component.

vertex_curvature_principal_dir2_matrix(self: pmeshlab.Mesh) numpy.ndarray[numpy.float64[m, 3]]

Returns the vertex curvature - principal direction 2 matrix of the mesh as a numpy array. Raises a MissingCompactnessException if the mesh is not compact. Raises a MissingComponentException if the mesh has no vertex curvature component.

vertex_custom_point_attribute_matrix(self: pmeshlab.Mesh, arg0: str) numpy.ndarray[numpy.float64[m, 3]]

Returns a numpy matrix containing the 3D point values of the given user defined attribute name associated to the vertices of the mesh. Raises a MissingCompactnessException if the mesh is not compact. Raises a PyMeshLabException if the given name does not represent a vertex vector attribute in the mesh.

vertex_custom_scalar_attribute_array(self: pmeshlab.Mesh, arg0: str) numpy.ndarray[numpy.float64[m, 1]]

Returns a numpy array containing the scalar values of the given user defined attribute name associated to the vertices of the mesh. Raises a MissingCompactnessException if the mesh is not compact. Raises a PyMeshLabException if the given name does not represent a vertex scalar attribute in the mesh.

vertex_matrix(self: pmeshlab.Mesh) numpy.ndarray[numpy.float64[m, 3]]

Returns the vertex matrix of the mesh as a numpy array, which is a #V*3 matrix of vertex coordinates. Raises a MissingCompactnessException if the mesh is not compact.

vertex_normal_matrix(self: pmeshlab.Mesh) numpy.ndarray[numpy.float64[m, 3]]

Returns the vertex normal matrix of the mesh as a numpy array, which is a #V*3 matrix of vertex normals. Raises a MissingCompactnessException if the mesh is not compact.

vertex_number(self: pmeshlab.Mesh) int

Returns the number of vertices of the mesh.

vertex_scalar_array(self: pmeshlab.Mesh) numpy.ndarray[numpy.float64[m, 1]]

Returns the vertex scalar array of the mesh as a numpy array, which is a #V array of floats. Raises a MissingCompactnessException if the mesh is not compact. Raises a MissingComponentException if the mesh has no vertex quality component.

vertex_selection_array(self: pmeshlab.Mesh) numpy.ndarray[bool[m, 1]]

Returns the vertex selection array of the mesh as a numpy array, which is a #V array of booleans (true if the corresponding vertex is selected, false otherwise). Raises a MissingCompactnessException if the mesh is not compact.

vertex_tex_coord_matrix(self: pmeshlab.Mesh) numpy.ndarray[numpy.float64[m, 2]]

Returns the vertex texcoord matrix of the mesh as a numpy array, which is a #V*2 matrix of uv texture coordinates. Raises a MissingCompactnessException if the mesh is not compact. Raises a MissingComponentException if the mesh has no per-wedge tex coordinates component.

wedge_tex_coord_matrix(self: pmeshlab.Mesh) numpy.ndarray[numpy.float64[m, 2]]

Returns the per-wedge texcoord matrix of the mesh as a numpy array, which is a #(F*3)*2 matrix of uv texture coordinates (triplets of wedges texcoords for each face). Raises a MissingCompactnessException if the mesh is not compact. Raises a MissingComponentException if the mesh has no vertex tex coordinates component.