Skip to main content

Module spatial

Module spatial 

Expand description

Cold caller-buffered native BVH construction and allocation-free nearest shoreline queries. Exact segment distances remain the acceptance criterion.

Structs§

Aabb
Axis-aligned bounding box in 3D.
BvhNode
BVH node: 40 bytes, repr(C), naturally aligned.
Point2
2D point in double precision for shoreline segment distance queries.
Point3
3D point in double precision for AABB and BVH queries.
ShoreSpatialScratch

Enums§

BvhError
Errors raised by the BVH builder.
SpatialOrderError
Errors raised by spatial ordering functions.

Constants§

BVH_NODE_SIZE
Node size in bytes.
MAX_BVH_DEPTH
Maximum BVH depth (bounded by 2^21 primitives -> 21 levels).

Functions§

build_bvh_recursive
Build a BVH using the deterministic Morton-sorted recursive builder.
point_segment_distance_sq_2d
Squared distance from point p to segment ab in 2D.
shore_distance_accelerated_into
Accelerated shore-distance field into out.
sort_by_morton_3d
Compute Morton codes for a 3D point set and sort indices by code.
spatial_working_bytes
Includes caller arrays and the native BVH builder’s bounded centroid scratch.