Function BBTree.QueryClosest

QueryClosest (float3 p, NNConstraint constraint, inProjectionParams projection, ref float distanceSqr, refNNInfo previous, GraphNode[] nodes, UnsafeSpan<int> triangles, UnsafeSpan<Int3> vertices)

Queries the tree for the closest node to p constrained by the NNConstraint trying to improve an existing solution.

Public
void QueryClosest (

float3

p

Point to search around

NNConstraint

constraint

Optionally set to constrain which nodes to return

inProjectionParams

projection

Projection parameters derived from the constraint

ref float

distanceSqr

The best squared distance for the previous solution. Will be updated with the best distance after this search. Supply positive infinity to start the search from scratch.

refNNInfo

previous

This search will start from the previous NNInfo and improve it if possible. Will be updated with the new result. Even if the search fails on this call, the solution will never be worse than previous.

GraphNode[]

nodes

The nodes what this BBTree was built from

UnsafeSpan<int>

triangles

The triangles that this BBTree was built from

UnsafeSpan<Int3>

vertices

The vertices that this BBTree was built from

)

Queries the tree for the closest node to p constrained by the NNConstraint trying to improve an existing solution.

Note that this function will only fill in the constrained node. If you want a node not constrained by any NNConstraint, do an additional search with constraint = NNConstraint.None