Per element attributes
Vertices
angle_defects(mesh, zero_border=False, name='angleDefect', persistent=True, dense=True)
Computes the angle defect at each vertex, defined as 2*pi minus the sum of angles around the vertex.
Angle defect is an discrete approximation of the gaussian curvature. This function relies on the computation of cotangents on the mesh.
Warning
Only works for triangulated meshes.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
mesh
|
SurfaceMesh
|
the mesh |
required |
zero_border
|
bool
|
if set to true, ignores the defect on the boundary of the mesh. Defaults to False. |
False
|
name
|
str
|
Name given to the attribute. Defaults to "angleDefect". |
'angleDefect'
|
persistent
|
bool
|
If the attribute is persistent (stored in the mesh object) or not. Defaults to True. |
True
|
dense
|
bool
|
Is the attribute dense (numpy array) or not (dict). Defaults to True |
True
|
Returns:
Type | Description |
---|---|
Attribute
|
Attribute(float) on vertices |
Raises:
Type | Description |
---|---|
Exception
|
fails if the mesh is not triangulated (ie if a face is not a triangle) |
border_normals(mesh, name='borderNormals', persistent=True, dense=False)
Computes the normal direction of the boundary curve.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
mesh
|
SurfaceMesh
|
the mesh |
required |
name
|
str
|
Name given to the attribute. Defaults to "borderNormals". |
'borderNormals'
|
persistent
|
bool
|
If the attribute is persistent (stored in the mesh object) or not. Defaults to True. |
True
|
dense
|
bool
|
Is the attribute dense (numpy array) or not (dict). Defaults to True |
False
|
Returns:
Type | Description |
---|---|
Attribute
|
Attribute(float,3) on vertices |
degree(mesh, name='degree', persistent=True, dense=True)
Computes the degree of each vertex, that is the number of vertex that are adjacent.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
mesh
|
Mesh
|
the input mesh. Pointclouds are forbidden |
required |
name
|
str
|
description. Defaults to "degree". |
'degree'
|
persistent
|
bool
|
If the attribute is persistent (stored in the mesh object) or not. Defaults to True. |
True
|
dense
|
bool
|
Is the attribute dense (numpy array) or not (dict). Defaults to True |
True
|
Returns:
Type | Description |
---|---|
Attribute
|
Attribute(int) on vertices |
vertex_normals(mesh, name='normals', persistent=True, interpolation='area', dense=True, custom_fnormals=None)
Computes normal directions as 3d vectors for each vertex. Normal at a vertex is a weighted sum of normals of adjacent faces. This function essentially interpolates the face normals.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
mesh
|
SurfaceMesh
|
the input mesh |
required |
name
|
str
|
Name given to the attribute. Defaults to "normals". |
'normals'
|
persistent
|
bool
|
If the attribute is persistent (stored in the mesh object) or not. Defaults to True. |
True
|
interpolation
|
str
|
Interpolation weighting mode. 'uniform' : computes the mean for adjacent facet 'area' : the mean is weighted by facet area. Default value. 'angle' : the mean is weighted by internal angle at the vertex |
'area'
|
dense
|
bool
|
Is the attribute dense (numpy array) or not (dict). Defaults to True |
True
|
custom_fnormals
|
Attribute
|
custom values for the face normals to be interpolated. Defaults to None. |
None
|
Raises:
Type | Description |
---|---|
Exception
|
if 'interpolation' is not one of {'uniform', 'area', 'angles'} |
Returns:
Type | Description |
---|---|
Attribute
|
Attribute(float, 3) on vertices |
Edges
cotan_weights(mesh, name='cotan_weight', persistent=True, dense=True)
Compute the cotan weights of edges. The weight of an edge separating T1 and T2 is the sum of cotangent of opposite angles in T1 and T2
Parameters:
Name | Type | Description | Default |
---|---|---|---|
mesh
|
Mesh
|
the input mesh. |
required |
name
|
str
|
name of the attribute. Defaults to "cotan_weight". |
'cotan_weight'
|
persistent
|
bool
|
If the attribute is persistent (stored in the mesh object) or not. Defaults to True. |
True
|
dense
|
bool
|
Is the attribute dense (numpy array) or not (dict). Defaults to True |
True
|
curvature_matrices(mesh)
Curvature matrix for each edge on the mesh, as defined in 'Restricted Delaunay Triangulations and Normal Cycle', David Cohen-Steiner and Jean-Marie Morvan, 2003
Note
See Curvature Frame Fields for their aggregation on triangles or vertices
edge_length(mesh, name='length', persistent=True, dense=True)
Compute edge lengths across the mesh.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
mesh
|
Mesh
|
the input mesh. PointClouds are forbidden (no edges). |
required |
name
|
str
|
name of the attribute. Defaults to "length". |
'length'
|
persistent
|
bool
|
If the attribute is persistent (stored in the mesh object) or not. Defaults to True. |
True
|
dense
|
bool
|
Is the attribute dense (numpy array) or not (dict). Defaults to True |
True
|
Faces
face_area(mesh, name='area', persistent=True, dense=True)
Computes the barycenter point of each face.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
mesh
|
SurfaceMesh
|
the input mesh |
required |
name
|
str
|
Name given to the attribute. Defaults to "area". |
'area'
|
persistent
|
bool
|
If the attribute is persistent (stored in the mesh object) or not. Defaults to True. |
True
|
dense
|
bool
|
Is the attribute dense (numpy array) or not (dict). Defaults to True |
True
|
Returns:
Name | Type | Description |
---|---|---|
Attribute |
Attribute
|
a float per faces |
face_barycenter(mesh, name='barycenter', persistent=True, dense=True)
Computes the barycenter point of each face.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
mesh
|
SurfaceMesh
|
the input mesh |
required |
name
|
str
|
Name given to the attribute. Defaults to "barycenter". |
'barycenter'
|
persistent
|
bool
|
If the attribute is persistent (stored in the mesh object) or not. Defaults to True. |
True
|
dense
|
bool
|
Is the attribute dense (numpy array) or not (dict). Defaults to True |
True
|
Returns:
Name | Type | Description |
---|---|---|
Attribute |
Attribute
|
one 3D vector per face |
face_circumcenter(mesh, name='circumcenter', persistent=True, dense=True)
Computes the circumcenter point of each triangular face.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
mesh
|
SurfaceMesh
|
the input mesh |
required |
name
|
str
|
Name given to the attribute. Defaults to "barycenter". |
'circumcenter'
|
persistent
|
bool
|
If the attribute is persistent (stored in the mesh object) or not. Defaults to True. |
True
|
dense
|
bool
|
Is the attribute dense (numpy array) or not (dict). Defaults to True |
True
|
Returns:
Name | Type | Description |
---|---|---|
Attribute |
Attribute
|
one float per face |
Raises:
Type | Description |
---|---|
Exception
|
fails if a face of the mesh is not a triangle |
face_normals(mesh, name='normals', persistent=True, dense=True)
Computes the barycenter point of each face.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
mesh
|
SurfaceMesh
|
the input mesh |
required |
name
|
str
|
Name given to the attribute. Defaults to "normals". |
'normals'
|
persistent
|
bool
|
If the attribute is persistent (stored in the mesh object) or not. Defaults to True. |
True
|
dense
|
bool
|
Is the attribute dense (numpy array) or not (dict). Defaults to True |
True
|
Returns:
Name | Type | Description |
---|---|---|
Attribute |
Attribute
|
3 floats per faces |
faces_near_border(mesh, dist=2, name='near_border', persistent=True, dense=False)
Returns the faces that are at most at 'dist' neighbours from the boundary. Proceeds by region growing, starting from all faces touching the boundary and going inwards.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
mesh
|
SurfaceMesh
|
the input mesh |
required |
dist
|
int
|
Extend to which we flag the faces. All faces with a path of length < dist to the boundary will be returned. Defaults to 2. |
2
|
name
|
str
|
Name given to the attribute. Defaults to "barycenter". |
'near_border'
|
persistent
|
bool
|
If the attribute is persistent (stored in the mesh object) or not. Defaults to True. |
True
|
dense
|
bool
|
Is the attribute dense (numpy array) or not (dict). Defaults to False |
False
|
Returns:
Name | Type | Description |
---|---|---|
Attribute |
Attribute
|
one bool per faces. If not persistent, returns a set. |
parallel_transport_curvature(mesh, PT, name='curvature', persistent=True, dense=True)
Compute the curvature of each face associated to a given parallel transport pT
Parameters:
Name | Type | Description | Default |
---|---|---|---|
mesh
|
SurfaceMesh
|
description |
required |
PT
|
dict
|
parallel transport. Dictionnary of keys (A,B) -> direction (angle) of edge (A,B) in local basis of A |
required |
name
|
str
|
Name given to the attribute.. Defaults to "curvature". |
'curvature'
|
persistent
|
bool
|
If the attribute is persistent (stored in the mesh object) or not. Defaults to True. |
True
|
dense
|
bool
|
Is the attribute dense (numpy array) or not (dict). Defaults to False. |
True
|
Returns:
Name | Type | Description |
---|---|---|
Attribute |
One float per face. |
triangle_aspect_ratio(mesh, name='aspect_ratio', persistent=True, dense=True)
Computes the aspect ratio of every triangular faces. Sets aspect ratio to -1 for every other faces
Parameters:
Name | Type | Description | Default |
---|---|---|---|
mesh
|
SurfaceMesh
|
the input mesh |
required |
name
|
str
|
Name given to the attribute. Defaults to "aspect_ratio". |
'aspect_ratio'
|
persistent
|
bool
|
If the attribute is persistent (stored in the mesh object) or not. Defaults to True. |
True
|
dense
|
bool
|
Is the attribute dense (numpy array) or not (dict). Defaults to False. |
True
|
Returns:
Name | Type | Description |
---|---|---|
Attribute |
Attribute
|
One float per face. |
Face Corners
corner_angles(mesh, name='angles', persistent=True, dense=True)
Attribute storing the angles of a face at a vertex
Parameters:
Name | Type | Description | Default |
---|---|---|---|
mesh
|
SurfaceMesh
|
the input mesh |
required |
name
|
str
|
Name given to the attribute. Defaults to "angles". |
'angles'
|
persistent
|
bool
|
If the attribute is persistent (stored in the mesh object) or not. Defaults to True. |
True
|
dense
|
bool
|
Is the attribute dense (numpy array) or not (dict). Defaults to True |
True
|
Returns:
Name | Type | Description |
---|---|---|
Attribute |
Attribute
|
one float per face corner |
cotangent(mesh, name='cotan', persistent=True, dense=True)
Attribute storing the cotangents of each face at each vertex.
Warning
Only works if the mesh is triangulated (ie every faces are triangles)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
mesh
|
SurfaceMesh
|
the input mesh |
required |
name
|
str
|
Name given to the attribute. Defaults to "cotan". |
'cotan'
|
persistent
|
bool
|
If the attribute is persistent (stored in the mesh object) or not. Defaults to True. |
True
|
dense
|
bool
|
Is the attribute dense (numpy array) or not (dict). Defaults to True |
True
|
Returns:
Type | Description |
---|---|
Attribute
|
Attribute(: one float per face corner |
Raises:
Type | Description |
---|---|
Exception
|
fails if the mesh is not triangulated |
Cells
cell_barycenter(mesh, name='barycenter', persistent=True, dense=True)
Computes the barycenter point of each cell.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
mesh
|
VolumeMesh
|
the input mesh |
required |
name
|
str
|
Name given to the attribute. Defaults to "barycenter". |
'barycenter'
|
persistent
|
bool
|
If the attribute is persistent (stored in the mesh object) or not. Defaults to True. |
True
|
dense
|
bool
|
Is the attribute dense (numpy array) or not (dict). Defaults to True |
True
|
Returns:
Name | Type | Description |
---|---|---|
Attribute |
Attribute
|
3D vector per cell |
cell_faces_on_boundary(mesh, name='boundary', persistent=True, dense=False)
Integer flag on cells. For each cell, computes the number of its faces that lay on the boundary
Parameters:
Name | Type | Description | Default |
---|---|---|---|
mesh
|
VolumeMesh
|
the input mesh |
required |
name
|
str
|
Name given to the attribute. Defaults to "boundary". |
'boundary'
|
persistent
|
bool
|
If the attribute is persistent (stored in the mesh object) or not. Defaults to True. |
True
|
dense
|
bool
|
Is the attribute dense (numpy array) or not (dict). Defaults to False |
False
|
Returns:
Name | Type | Description |
---|---|---|
Attribute |
Attribute
|
bool per cell |
cell_volume(mesh, name='volume', persistent=True, dense=True)
Computes the volume of each cell.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
mesh
|
VolumeMesh
|
the input mesh |
required |
name
|
str
|
Name given to the attribute. Defaults to "volume". |
'volume'
|
persistent
|
bool
|
If the attribute is persistent (stored in the mesh object) or not. Defaults to True. |
True
|
dense
|
bool
|
Is the attribute dense (numpy array) or not (dict). Defaults to True |
True
|
Returns:
Name | Type | Description |
---|---|---|
Attribute |
Attribute
|
one float per cell |