# Geometry module¶

class TriangleMesh

Corresponds to C++ class walberla::geometry::TriangleMesh

numTriangles

Number of triangles.

numVertices

Number of vertices.

numVertexNormals

Number of vertex normals.

getAABB()

Returns the axis aligned bounding box of the mesh.

volume()

Volume of the Mesh.

scale(factor)

Scales the complete mesh by the given factor.

scaleXYZ(factors)

Scales the mesh by different factors in x,y,z direction.

Parameters: factors – tuple or list with 3 entries corresponding to x,y,z factors
exchangeAxes(xAxisId, yAxisId, zAxisId)

Permutes the coordinate order of each vertex. e.g. m.exchangeAxes(0,2,1) exchanges z and y axis.

removeDuplicateVertices(tolerance = 1e-4)

Merges vertices with a distance smaller than tolerance

merge(other, offset=(0, 0, 0 ))

Merges another mesh into the current mesh. During the merging all vertices of the other mesh are shifted by the given offset.

save(filename)

Saves the mesh to a file. The mesh format is deduced using the filename extension. Supported formats are: obj,pov,off and vtp.

static load(filename, broadcast=True)

Loads mesh from a file. The mesh format is deduced using the filename extension. Supported formats are obj, pov and off.

Parameters: broadcast – If True the mesh is read on the root system only and broadcasted to all other processes using MPI to reduce file system load.