trimesh.permutate¶
permutate.py¶
Randomly deform meshes in different ways.
Classes:
|
Functions:
|
Add gaussian noise to every vertex of a mesh, making no effort to maintain topology or sanity. |
|
Subdivide each face of a mesh into three faces with the new vertex randomly placed inside the old face. |
|
Return a permutated variant of a mesh by randomly reording faces and rotatating + translating a mesh by a random matrix. |
-
class
trimesh.permutate.
Permutator
(mesh)¶ Bases:
object
Methods:
noise
([magnitude])Add gaussian noise to every vertex of a mesh, making no effort to maintain topology or sanity.
Subdivide each face of a mesh into three faces with the new vertex randomly placed inside the old face.
transform
([translation_scale])Return a permutated variant of a mesh by randomly reording faces and rotatating + translating a mesh by a random matrix.
-
noise
(magnitude=None)¶ Add gaussian noise to every vertex of a mesh, making no effort to maintain topology or sanity.
- Parameters
mesh (trimesh.Trimesh) – Input geometry, will not be altered
magnitude (float) – What is the maximum distance per axis we can displace a vertex. If None, value defaults to (mesh.scale / 100.0)
- Returns
permutated – Input mesh with noise applied
- Return type
-
tessellation
()¶ Subdivide each face of a mesh into three faces with the new vertex randomly placed inside the old face.
This produces a mesh with exactly the same surface area and volume but with different tessellation.
- Parameters
mesh (trimesh.Trimesh) – Input geometry
- Returns
permutated – Mesh with remeshed facets
- Return type
-
transform
(translation_scale=1000)¶ Return a permutated variant of a mesh by randomly reording faces and rotatating + translating a mesh by a random matrix.
- Parameters
mesh (trimesh.Trimesh) – Mesh, will not be altered by this function
- Returns
permutated – Mesh with same faces as input mesh but reordered and rigidly transformed in space.
- Return type
-
-
trimesh.permutate.
noise
(mesh, magnitude=None)¶ Add gaussian noise to every vertex of a mesh, making no effort to maintain topology or sanity.
- Parameters
mesh (trimesh.Trimesh) – Input geometry, will not be altered
magnitude (float) – What is the maximum distance per axis we can displace a vertex. If None, value defaults to (mesh.scale / 100.0)
- Returns
permutated – Input mesh with noise applied
- Return type
-
trimesh.permutate.
tessellation
(mesh)¶ Subdivide each face of a mesh into three faces with the new vertex randomly placed inside the old face.
This produces a mesh with exactly the same surface area and volume but with different tessellation.
- Parameters
mesh (trimesh.Trimesh) – Input geometry
- Returns
permutated – Mesh with remeshed facets
- Return type
-
trimesh.permutate.
transform
(mesh, translation_scale=1000.0)¶ Return a permutated variant of a mesh by randomly reording faces and rotatating + translating a mesh by a random matrix.
- Parameters
mesh (trimesh.Trimesh) – Mesh, will not be altered by this function
- Returns
permutated – Mesh with same faces as input mesh but reordered and rigidly transformed in space.
- Return type