Skip to main content

Module hull

Module hull 

Source
Expand description

Convex hull construction and query module.

Port of box3d-cpp-reference/src/hull.c: quickhull construction, box hulls, validate, identity, plus mass/AABB/overlap/cast query APIs. The verstable hull map is deferred.

Structs§

BoxHull
Efficient box hull with embedded arrays matching C b3BoxHull.
HullData
A convex hull.
HullDataView
Borrowed view of hull geometry (owned hull or box hull).
HullDatabase
Shared hull store for a world. (b3HullMap + world->hullDatabase)
HullFace
A hull face. Hulls use a half-edge data structure, so a face can be determined from a single half-edge index.
HullHalfEdge
Half-edge for hull data structure.
HullVertex
A hull vertex. Identified by a half-edge with this vertex as its tail.

Constants§

BOX_HULL_SIZE
Size of the C b3BoxHull. (_Static_assert in hull.c)
HULL_DATA_SIZE
Size of the C b3HullData header. (_Static_assert in hull.c)
HULL_VERSION
64-bit hull version. Useful for validating serialized data. (B3_HULL_VERSION)

Functions§

clone_and_transform_hull
Clone a hull, then scale/rotate/translate it. Recomputes planes, bounds, and bulk properties, so the result is a fully valid hull. A negative net scale (reflection) reverses each face’s edge winding so the hull stays outward-facing. Returns None if original is invalid or the transformed hull degenerates. (b3CloneAndTransformHull)
clone_hull
Clone a hull. (b3CloneHull)
collide_mover_and_hull
Collide a capsule mover against a hull. (b3CollideMoverAndHull)
compare_hull_data
Compare two hulls by C contiguous-blob equality. (b3CompareHullData)
compute_hull_aabb
Compute the AABB of a hull. (b3ComputeHullAABB)
compute_hull_extent
Compute the extent of a hull relative to an origin. (b3ComputeHullExtent)
compute_hull_mass
Compute mass properties of a hull. (b3ComputeHullMass)
compute_hull_projected_area
Projected area of a hull onto a plane with the given direction. Fan-triangulates each face and sums max(dot(cross(e1, e2), direction), 0). (b3ComputeHullProjectedArea)
compute_swept_hull_aabb
Compute the swept AABB of a hull between two transforms. (b3ComputeSweptHullAABB)
convert_bytes_to_hull
Restore a hull from a contiguous blob. (inverse of HullData::to_bytes)
create_cone
Create a cone/frustum hull. (b3CreateCone)
create_cylinder
Create a cylinder hull. (b3CreateCylinder)
create_hull
Create a convex hull from a point cloud. (b3CreateHull)
create_rock
Create a rock-like hull from a Fibonacci lattice. (b3CreateRock)
destroy_hull
Destroy is a no-op for owned Rust hulls; kept for API parity. (b3DestroyHull)
find_hull_support_face
Find the support face in a direction. (b3FindHullSupportFace)
find_hull_support_vertex
Find the support vertex in a direction. (b3FindHullSupportVertex)
get_hull_edges
Get hull half-edges. (collision.h: b3GetHullEdges)
get_hull_faces
Get hull faces. (collision.h: b3GetHullFaces)
get_hull_planes
Get hull face planes. (collision.h: b3GetHullPlanes)
get_hull_points
Get hull points. (collision.h: b3GetHullPoints)
get_hull_vertices
Get hull vertices. (collision.h: b3GetHullVertices)
hash_hull_data
Spread the baked 32-bit content hash across 64 bits. (b3HashHullData)
is_valid_hull
Validate hull topology and bulk properties. (b3IsValidHull)
make_box_hull
Make a box as a hull. (b3MakeBoxHull)
make_cube_hull
Make a cube as a hull. (b3MakeCubeHull)
make_offset_box_hull
Make an offset box as a hull. (b3MakeOffsetBoxHull)
make_scaled_box_hull
Make a scaled box hull. (b3MakeScaledBoxHull)
make_transformed_box_hull
Make a transformed box as a hull. (b3MakeTransformedBoxHull)
overlap_hull
Test overlap between a hull and a shape proxy. (b3OverlapHull)
ray_cast_hull
Ray cast versus hull shape in local space. (b3RayCastHull)
scale_box
Scale a box’s half-widths and transform by a post-scale. (b3ScaleBox)
shape_cast_hull
Shape cast versus a hull. (b3ShapeCastHull)