KDTree.fromNode constructor

KDTree.fromNode(
  1. List<Node> nodes, [
  2. bool useVariance = true
])

Construct a KDTree from a list of Node instances.

It takes the forementioned list of nodes and an optional parameter useVariance. The Node instances are mapped to KDNode instances for use in the kd-tree algorithms.

For more information, also about the concept of variance please refere to the documents linked above.

Implementation

KDTree.fromNode(List<Node> nodes, [bool useVariance = true])
    : _useVariance = useVariance {
  _root = _buildTree(nodes.map((e) => KDNode(e)).toList(), 0);
}