trimesh.parent

parent.py

The base class for Trimesh, PointCloud, and Scene objects

Classes:

ABC()

Helper class that provides a standard way to create an ABC using inheritance.

Geometry()

Geometry is the parent class for all geometry.

Geometry3D()

The Geometry3D object is the parent object of geometry objects which are three dimensional, including Trimesh, PointCloud, and Scene objects.

class trimesh.parent.Geometry

Bases: abc.ABC

Geometry is the parent class for all geometry.

By decorating a method with abc.abstractmethod it just means the objects that inherit from Geometry MUST implement those methods.

Methods:

apply_scale(scaling)

Scale the mesh.

apply_transform(matrix)

apply_translation(translation)

Translate the current mesh.

copy()

crc()

is_empty()

md5()

show()

Attributes:

bounds

extents

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()
abstract crc()
abstract property extents
abstract is_empty()
abstract md5()
abstract show()
class trimesh.parent.Geometry3D

Bases: trimesh.parent.Geometry

The Geometry3D object is the parent object of geometry objects which are three dimensional, including Trimesh, PointCloud, and Scene objects.

Methods:

apply_obb()

Apply the oriented bounding box transform to the current mesh.

Attributes:

bounding_box

An axis aligned bounding box for the current mesh.

bounding_box_oriented

An oriented bounding box for the current mesh.

bounding_cylinder

A minimum volume bounding cylinder for the current mesh.

bounding_primitive

The minimum volume primitive (box, sphere, or cylinder) that bounds the mesh.

bounding_sphere

A minimum volume bounding sphere for the current mesh.

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

trimesh.primitives.Box

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

trimesh.primitives.Box

property bounding_cylinder

A minimum volume bounding cylinder for the current mesh.

Returns

mincyl – Cylinder primitive containing current mesh

Return type

trimesh.primitives.Cylinder

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

trimesh.primitives.Sphere