trimesh.comparison¶
comparison.py¶
Provide methods for quickly hashing and comparing meshes.
Functions:
|
Return the size-order of every face in the input mesh. |
|
Hash an identifier array to a specified number of significant figures. |
|
Return a basic identifier for a mesh, consisting of properties that have been hand tuned to be somewhat robust to rigid transformations and different tesselations. |
-
trimesh.comparison.
face_ordering
(mesh)¶ Return the size-order of every face in the input mesh.
- Triangles can be considered by the length order:
[small edge, medium edge, large edge] (SML) [small edge, large edge, medium edge] (SLM)
This function returns [-1, 0, 1], depending on whether the triangle is SML or SLM, and 0 if M == L.
The reason this is useful as it as a rare property that is invariant to translation and rotation but changes when a mesh is reflected or inverted. It is NOT invariant to different tesselations of the same surface.
- Parameters
mesh (trimesh.Trimesh) – Source geometry to calculate ordering on
- Returns
order – Is each face SML (-1), SLM (+1), or M==L (0)
- Return type
(len(mesh.faces), ) int
-
trimesh.comparison.
identifier_hash
(identifier, sigfig=None)¶ Hash an identifier array to a specified number of significant figures.
- Parameters
identifier ((n,) float) – Vector of properties
sigfig ((n,) int) – Number of sigfigs per property
- Returns
md5 – MD5 hash of identifier
- Return type
str
-
trimesh.comparison.
identifier_simple
(mesh)¶ Return a basic identifier for a mesh, consisting of properties that have been hand tuned to be somewhat robust to rigid transformations and different tesselations.
- Parameters
mesh (trimesh.Trimesh) – Source geometry
- Returns
identifier – Identifying values of the mesh
- Return type
(6,) float