kdTree

@JvmName(name = "kdTreeVector2")
fun Iterable<Vector2>.kdTree(): KDTreeNode<Vector2>(source)

Constructs a KD-Tree for a collection of 2D vectors.

This function creates a KD-Tree from the given iterable collection of Vector2 objects. The KD-Tree is built in a way that organizes the points for efficient spatial operations, such as nearest neighbor search or range queries, considering two dimensions (x and y).

Return

The root node of the KD-Tree representing the input collection of 2D vectors.


@JvmName(name = "kdTreeVector3")
fun Iterable<Vector3>.kdTree(): KDTreeNode<Vector3>(source)

Constructs a KD-Tree from an iterable collection of 3-dimensional Vector3 objects.

This function converts the input iterable into a mutable list and utilizes the buildKDTree method to organize the Vector3 objects into a spatial data structure for efficient querying.

Return

The root node of the constructed KD-Tree containing the Vector3 objects.


@JvmName(name = "kdTreeVector4")
fun Iterable<Vector4>.kdTree(): KDTreeNode<Vector4>(source)

Constructs a KD-Tree from the iterable collection of 4-dimensional vectors.

This method uses the components of each Vector4 (x, y, z, w) as the coordinate axes in a 4-dimensional space to build the KD-Tree.

Receiver

An iterable collection of Vector4 objects to be organized in the KD-Tree.

Return

The root node of the constructed KD-Tree containing the Vector4 objects.