trimesh.comparison
comparison.py
Provide methods for quickly hashing and comparing meshes.
- 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)
Hash an identifier array in a way that is hand-tuned to be somewhat robust to likely changes.
- Parameters
identifier ((n,) float) – Vector of properties
- Returns
hash – A SHA256 of the identifier vector at hand-tuned precision.
- Return type
(64,) 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
(7,) float