Skip to main content

Module box_shape

Module box_shape 

Source
Expand description

Axis-aligned box shape.

Structs§

BoxShape
An axis-aligned box defined by half-extents.

Functions§

obb_aabb_bounds
Compute the AABB bounds (lo, hi) of an OBB in world space.
obb_closest_point
Closest point on the surface of an OBB to a world-space point p. center: OBB center in world space. half_extents: half-widths along each local axis. rot: rotation matrix (row i = world direction of local axis i). Returns world-space closest point (may be on interior if p is inside).
obb_edges
Returns all 12 edges of the OBB in world space as (start, end) pairs.
obb_face_centers
Returns the 6 face centers of the OBB in world space. Order: +local_x, -local_x, +local_y, -local_y, +local_z, -local_z.
obb_inertia_tensor
Inertia tensor of an OBB in its own local frame (diagonal matrix). half_extents: half-widths along each local axis. Returns a 3×3 row-major array.
obb_inertia_tensor_rotated
Inertia tensor of an OBB transformed to world frame via rotation matrix rot. rot maps local axes to world axes (each row is a world-space basis vector). Uses I_world = R * I_local * R^T.
obb_plane_distance
Signed distance from the OBB to a plane (ax + by + cz + d = 0). Returns (min_signed_dist, max_signed_dist) for the OBB interval projected on the plane normal. If min < 0 && max > 0, the OBB straddles the plane.
obb_projection_extent
Compute the projection half-extent of an OBB onto a world-space axis. This is the sum of |half_i * dot(rot_col_i, axis)| over i.
obb_ray_intersection
Ray-OBB intersection using the slab method in local OBB space. ray_origin, ray_dir: world-space ray. center, half_extents, rot: OBB parameters. Returns the hit parameter t if intersection within [0, max_toi], else None.
obb_support_fn
GJK support function for an OBB: returns the farthest vertex in direction.
obb_vertices
Returns all 8 vertices of the OBB in world space.