trimesh.convex

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

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 Qt', repair=True)

Get a new Trimesh object representing the convex hull of the current mesh attempting to return a watertight mesh with correct normals.

Details on qhull options:

http://www.qhull.org/html/qh-quick.htm#options

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

  • qhull_options (str) – Options to pass to qhull.

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