Skip to content

ludus::foundation::geometry::PointSearchTree

Ludus Wiki · API overview · Browse API

Class

Deterministic balanced point tree, independent of mesh topology and ray-tracing BVHs. Build is fallible and O(n log² n); queries allocate nothing. Concurrent queries are safe while the tree remains immutable. Mutation requires exclusive access.

Declared in modules/foundation/geometry/include/ludus/foundation/geometry/point_search.hpp

#include <ludus/foundation/geometry/point_search.hpp>
class ludus::foundation::geometry::PointSearchTree final

Methods

Build

GeometryStatus ludus::foundation::geometry::PointSearchTree::Build(BorrowedView< const math::Vector3 > positionsWorld) noexcept
Copy finite positions and build a balanced tree; duplicate positions are valid. Reject invalid/empty views, excessive coordinate magnitudes or uint32 count overflow. Failure preserves the entire previous tree. No input borrow survives.

Related types: BorrowedView · GeometryStatus · math::Vector3

Declared in modules/foundation/geometry/include/ludus/foundation/geometry/point_search.hpp

FindNearest

GeometryStatus ludus::foundation::geometry::PointSearchTree::FindNearest(math::Vector3 positionWorld, BorrowedView< PointNeighbor > outNeighbors) const noexcept
Find exactly outNeighbors.GetSize() nearest points, 1..MAX_POINT_NEIGHBORS and no more than the tree's point count. Query obeys the build coordinate bound. Invalid input preserves output. Ties use original source index; geometrically near ties can differ across CPU/GPU floating implementations.

Related types: BorrowedView · GeometryStatus · PointNeighbor · math::Vector3

Declared in modules/foundation/geometry/include/ludus/foundation/geometry/point_search.hpp

GetNodes

BorrowedView< const PointSearchNode > ludus::foundation::geometry::PointSearchTree::GetNodes() const noexcept
Borrow immutable packed nodes until the next successful Build or destruction.

Related types: BorrowedView · PointSearchNode

Declared in modules/foundation/geometry/include/ludus/foundation/geometry/point_search.hpp

GetRoot

uint32 ludus::foundation::geometry::PointSearchTree::GetRoot() const noexcept
Root node index, or ABSENT_POINT_NODE for an unbuilt tree.

Related types: uint32

Declared in modules/foundation/geometry/include/ludus/foundation/geometry/point_search.hpp