trimesh.convex module

convex.py

Deal with creating and checking convex objects in 2, 3 and N dimensions.

Convex is defined as: 1) “Convex, meaning “curving out” or “extending outward” (compare to concave) 2) having an outline or surface curved like the exterior of a circle or sphere. 3) (of a polygon) having only interior angles measuring less than 180

Functions

adjacency_projections(mesh)

Test if a mesh is convex by projecting the vertices of a triangle onto the normal of its adjacent face.

convex_hull(obj[, qhull_options])

Get a new Trimesh object representing the convex hull of the current mesh, with proper normals and watertight.

hull_points(obj[, qhull_options])

Try to extract a convex set of points from multiple input formats.

is_convex(mesh)

Check if a mesh is convex.

trimesh.convex.adjacency_projections(mesh)

Test if a mesh is convex by projecting the vertices of a triangle onto the normal of its adjacent face.

Parameters

mesh (Trimesh) – Input geometry

Returns

projection – Distance of projection of adjacent vertex onto plane

Return type

(len(mesh.face_adjacency),) float

trimesh.convex.convex_hull(obj, qhull_options='QbB Pp QJn')

Get a new Trimesh object representing the convex hull of the current mesh, with proper normals and watertight. Requires scipy >.12.

Parameters

obj (Trimesh, or (n,3) float) – Mesh or cartesian points

Returns

convex – Mesh of convex hull

Return type

Trimesh

trimesh.convex.hull_points(obj, qhull_options='QbB Pp')

Try to extract a convex set of points from multiple input formats.

Parameters

obj (Trimesh object) – (n,d) points (m,) Trimesh objects

Returns

points

Return type

(o,d) convex set of points

trimesh.convex.is_convex(mesh)

Check if a mesh is convex.

Parameters

mesh (Trimesh) – Input geometry

Returns

convex – Was passed mesh convex or not

Return type

bool