m3sh.traits#
Geometric mesh traits.
Convenience functions to compute common and often used geometric mesh traits like normals (see, e.g., [1]) and curvature (see [2]).
Important
Functions defined in this module are only applicable to meshes in Euclidean 3-space, i.e., meshes with vertex coordinate array of shape (n, 3). They cannot be applied to 2-manifold meshes embedded in higher dimensional space.
Example#
Face normals of a mesh can be computed as
>>> normals = traits.face_normals(mesh)
Since faces can be used as an index, the normal of a face can be accessed
as normals[f] or more verbosely as normals[f.index]. Instead of
passing around the pair (mesh, normals), we can add the normals array
to the mesh as an attribute:
>>> mesh.add_face_data('face_normals', 'normal', normals)
In addition to just adding the array as an attribute this also add a
property to each face of the mesh that makes the corresponding face normal
accessible as f.normal. The normals array can still be accessed
directly as mesh.face_normals. In particular
>>> mesh.face_normals is normals
True
References#
S. Jin, R. Lewis, and D. West: A comparison of algorithms for vertex normal computation, The Visual Computer 21, 2005.
M. Meyer et al.: Discrete differential-geometry operators for triangulated 2-manifolds, in HC. Hege, K. Polthier (eds) Visualization and Mathematics III, 2003.
Functions
|
Surface area of triangle mesh. |
|
Rotation parameters. |
|
Cotangent weight. |
|
Cotangent weights. |
|
Diameter of a point set. |
|
Dihedral angle. |
|
Dihedral angles. |
|
Edge length statistics. |
|
Area of triangular face. |
|
Canonical frame of a face. |
|
Face normal vector. |
|
Face normals. |
|
Gaussian curvature estimate. |
|
Gaussian curvate estimate. |
|
Laplace matrix. |
|
Mean curvature estimate. |
|
Mean curvature vector. |
|
Mean curvature vectors. |
|
Mean curvature estimates. |
|
Principal curvature estimate. |
|
Total angle around a vertex. |
|
Vertex area. |
|
Mixed vertex areas. |
|
Vertex normal. |
|
Vertex normals. |