The deepest box's depth, as traverse reports it (the root's children at 1).
How the tree's entries pair up.
StaticbuildBuilds a tree over the input's segments (see the file comment); keeps input as its source.
The primitive nearest point and the nearest point on it (ties: the
lower entry), as CpuMeshBvh.closestPointToPoint: null when none is
within maxThreshold; the walk stops at the first one within
minThreshold. target.point is written in place when present.
StaticdeserializeReads bytes from serialize, checked.
Bytes this object holds: nodes, records and bounds. Not the source.
Box around every primitive, current after refit, as CpuMeshBvh.getBoundingBox.
Optionaltarget: TThe segment at a tree position, as the tree stores it.
Optionaltarget: TEvery primitive within threshold of the ray, sorted by distance (then
entry): three's Points.raycast / Line.raycast in the tree's space.
The direction is normalized first unless it is unit length (three's rays are).
The closest primitive within threshold of the ray (ties: the lower entry), or null: three-mesh-bvh's firstHitOnly.
Rereads the primitives' positions (from input, else the source the
tree was built from) and refits every box, keeping the tree's shape:
three-mesh-bvh's refit(). The index and range must be the build's.
Optionalinput: BvhPointsInput | BvhSegmentsInputThe entry of the primitive at a tree position (as traverse reports them).
The tree as bytes: a 64-byte header ("BVHP", format 1, kind, mode,
entry range, counts, bounds), the nodes, the records. CpuPointsBvh.deserialize
and CpuSegmentsBvh.deserialize read it back, checked.
three-mesh-bvh's LineSegmentsBVH.shapecast: intersectsBounds,
intersectsRange, boundsTraverseOrder as CpuMeshBvh.shapecast's, and
intersectsLine(line, index, contained, depth) per segment with its entry.
Walks the tree with CpuMeshBvh.traverse's contract (three-mesh-bvh's
shapecast): depth first, the root's box never asked about, each child
scored once by boundsTraverseOrder and the lower score first, a falsy
intersectsBounds skipping the box, a contained box reported as one
range, a truthy intersectsRange stopping the walk. Ranges are tree
positions: map them with resolvePrimitiveIndex. Returns true when stopped.
three-mesh-bvh's node walk, as CpuMeshBvh.traverseNodes (for the
helper and the debug functions): every node depth first, the root at
depth 0 with the tree's bounds; a leaf gets its first tree position and
count, an inner node the axis its children's centres lie furthest apart on.
The box around the primitives at tree positions offset to
offset + count - 1: read from the source when the tree has one (so
edits since the last refit show, as validateBounds wants),
else from the records.
A tree over line segments (three-mesh-bvh's
LineSegmentsBVH,LineLoopBVHandLineBVH, by BvhSegmentsInput.mode), engine-free: raycasts with three'sLine.raycastthreshold and answers, shapecasts, closest point, refit and saving.