trimesh.parent
parent.py
The base class for Trimesh, PointCloud, and Scene objects
- class trimesh.parent.Geometry
Bases:
ABC
Geometry is the parent class for all geometry.
By decorating a method with abc.abstractmethod it means the objects that inherit from Geometry MUST implement those methods.
- apply_scale(scaling)
Scale the mesh.
- Parameters
scaling (float or (3,) float) – Scale factor to apply to the mesh
- abstract apply_transform(matrix)
- apply_translation(translation)
Translate the current mesh.
- Parameters
translation ((3,) float) – Translation in XYZ
- abstract property bounds
- abstract copy()
- crc()
DEPRECATED OCTOBER 2023 : Use hash(geometry)
Get a hash of the current geometry.
- Returns
hash – Hash of current graph and geometry.
- Return type
int
- abstract export(file_obj, file_type=None)
- abstract property extents
- hash()
DEPRECATED OCTOBER 2023 : Use hash(geometry)
Get a hash of the current geometry.
- Returns
hash – Hash of current graph and geometry.
- Return type
int
- abstract is_empty()
- md5()
DEPRECATED OCTOBER 2023 : Use hash(geometry)
Get a hash of the current geometry.
- Returns
hash – Hash of current graph and geometry.
- Return type
int
- abstract show()
- class trimesh.parent.Geometry3D
Bases:
Geometry
The Geometry3D object is the parent object of geometry objects which are three dimensional, including Trimesh, PointCloud, and Scene objects.
- apply_obb()
Apply the oriented bounding box transform to the current mesh.
This will result in a mesh with an AABB centered at the origin and the same dimensions as the OBB.
- Returns
matrix – Transformation matrix that was applied to mesh to move it into OBB frame
- Return type
(4, 4) float
- property bounding_box
An axis aligned bounding box for the current mesh.
- Returns
aabb – Box object with transform and extents defined representing the axis aligned bounding box of the mesh
- Return type
- property bounding_box_oriented
An oriented bounding box for the current mesh.
- Returns
obb – Box object with transform and extents defined representing the minimum volume oriented bounding box of the mesh
- Return type
- property bounding_cylinder
A minimum volume bounding cylinder for the current mesh.
- Returns
mincyl – Cylinder primitive containing current mesh
- Return type
- property bounding_primitive
The minimum volume primitive (box, sphere, or cylinder) that bounds the mesh.
- Returns
bounding_primitive – Smallest primitive which bounds the mesh: trimesh.primitives.Sphere trimesh.primitives.Box trimesh.primitives.Cylinder
- Return type
object
- property bounding_sphere
A minimum volume bounding sphere for the current mesh.
Note that the Sphere primitive returned has an unpadded exact sphere_radius so while the distance of every vertex of the current mesh from sphere_center will be less than sphere_radius, the faceted sphere primitive may not contain every vertex.
- Returns
minball – Sphere primitive containing current mesh
- Return type