new KDTreeXY(points)
Creates a new KDTree instance from an array of path points.
Parameters:
| Name | Type | Description |
|---|---|---|
points |
Array.<PD.PathPoint> | The array of path points to search through. |
Methods
-
buildTree(points, depth)
-
Recursively builds a 3D KD tree.
Parameters:
Name Type Description pointsArray.<Object> Array of points, each with {x, y, z}.
depthnumber The current depth within the tree.
Returns:
A node representing part of the KD tree.
- Type
- Object | null
-
findColinear(pathPoint, tolerance, results, depth)
-
Searches for all points within the bounds of the path segment that are within the given tolerance of its linear path.
Parameters:
Name Type Default Description pathPointPD.PathPoint The path segment to search around.
tolerancenumber The distance from the segment to search within.
resultsArray.<PD.PathPoint> An array to store the found points.
depthnumber 0 The current depth of the tree.
Returns:
Returns the
resultsarray containing the found points.- Type
- Array.<PD.PathPoint>
-
fromPaths(paths) <static>
-
Creates a new KDTree instance from points in the given paths.
Parameters:
Name Type Description pathsArray.<PD.Path> The list of paths to search through.
Returns:
Returns a new KDTreeXY instance.
- Type
- KDTreeXY