Class: KDTreeOrientation

PD.Shell. KDTreeOrientation

A class that implements a 3D vector KDTree for finding facets with matching surfaces normals (effectively a similar orientation).


new KDTreeOrientation(facets)

Creates a new KDTree instance from an array of shell facets.

Parameters:
Name Type Description
facets PD.Shell | Array.<PD.Polygon>

A shell or array of polygonal facets to search through.

Author:
  • drajmarsh

Methods


matchOrientation(normal [, k])

Finds the k-nearest neighbors to the given query normal.

Parameters:
Name Type Argument Default Description
normal THREE.Vector3

The query {x,y,z} normalised direction vector to match.

k number <optional>
1

Number of nearest neighbors to return.

Returns:

Array of the k closest facets.

Type
Array.<PD.Polygon>

matchOrientationRange(normal [, tolerance])

Finds all facets within a given threshold tolerance from the query normal.

Parameters:
Name Type Argument Default Description
normal THREE.Vector3

The query normal to match {x, y, z}.

tolerance number <optional>
0.035

The tolerance radius within which to search, defaults to 0.035 [sin(2deg)].

Returns:

Array of facets within the given radius.

Type
Array.<PD.Polygon>