Skip to content

On faces

PointCloud(data=None)

Bases: Mesh

A data structure for representing point clouds

Attributes:

Name Type Description
vertices DataContainer

the container for all vertices

__str__ str

Representation of the object and its elements as a string.

id_vertices property

Shortcut for range(len(self.vertices))

append(x)

Shortcut for self.vertices.append(x), since we can only append elements in the 'vertices' container

PolyLine(data=None)

Bases: Mesh

A data structure for representing polylines.

Attributes:

Name Type Description
vertices DataContainer

the container for all vertices

edges DataContainer

the container for all edges

__str__

Representation of the object and its elements as a string.

id_edges property

Shortcut for range(len(self.edges))

id_vertices property

Shortcut for range(len(self.vertices))

SurfaceMesh(data=None)

Bases: Mesh

A data structure for representing polygonal surfaces.

Attributes:

Name Type Description
vertices DataContainer

the container for all vertices

edges DataContainer

the container for all edges

faces DataContainer

the container for all faces

face_corners DataContainer

the container for all corner of faces

boundary_edges list

list of all edge indices on the boundary

interior_edges list

list of all interior edge indices (all edges \ boundary_edges)

boundary_vertices list

list of all vertex indices on the boundary

interior_vertices list

list of all interior verticex indices (all vertices \ boundary_vertices)

connectivity _SurfaceConnectivity

the connectivity utility class

id_corners property

Shortcut for range(len(self.face_corners))

id_edges property

Shortcut for range(len(self.edges))

id_faces property

Shortcut for range(len(self.faces))

id_vertices property

Shortcut for range(len(self.vertices))

clear_boundary_data()

Clear all boundary data. Next call to a boundary/interior container or method will recompute everything

is_edge_on_border(u, v)

whether edge (u,v) is a boundary edge or not

Parameters:

Name Type Description Default
u int

vertex id

required
v int

vertex id

required

Returns:

Name Type Description
bool bool

whether edge (u,v) is a boundary edge or not. Returns False if (u,v) is not a valid edge.

is_quad()

Returns:

Name Type Description
bool bool

True if the mesh is quadrangular (all faces are quad)

is_triangular()

Returns:

Name Type Description
bool bool

True if the mesh is triangular (all faces are triangles)

is_vertex_on_border(u)

whether vertex u is a boundary vertex or not.

Parameters:

Name Type Description Default
u int

vertex id

required

Returns:

Name Type Description
bool bool

whether vertex u is a boundary vertex or not.

ith_vertex_of_face(fid, i)

helper function to get the i-th vertex of a face, i.e. self.faces[fid][i]

Parameters:

Name Type Description Default
fid int

face id

required
i int

vertex id in face. Should be 0 <= vid < len(face)

required

Returns:

Name Type Description
int int

the id of the i-th vertex in face fid (self.faces[fid][i])

pt_of_face(fid)

point coordinates of vertices of face fid

Parameters:

Name Type Description Default
fid int

face id

required

Returns:

Name Type Description
Iterable

iterator of Vec objects representing point coordinates of vertices

VolumeMesh(data=None)

Bases: Mesh

id_cells property

Shortcut for range(len(self.cells))

id_corners property

Shortcut for range(len(self.face_corners))

id_edges property

Shortcut for range(len(self.edges))

id_faces property

Shortcut for range(len(self.faces))

id_vertices property

Shortcut for range(len(self.vertices))

is_edge_on_border(*args)

Simple test to determine if a given edge is on the boundary of the mesh.

Returns:

Name Type Description
bool bool

Returns True if the given edge is on the boundary of the mesh.

is_face_on_border(*args)

Simple test to determine if a given face is on the boundary of the mesh.

Returns:

Name Type Description
bool bool

Returns True is the given face exists and is on the boundary of the mesh

is_tetrahedral()

Returns:

Name Type Description
bool bool

True if the mesh is tetrahedral (all cells are tetrahedra)

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.