Class KdTreeImpl
java.lang.Object
cz.fidentis.analyst.data.kdtree.impl.KdTreeImpl
- All Implemented Interfaces:
KdTree
,Serializable
Implementation of k-D trees.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionKdTreeImpl
(Collection<MeshFacet> facets) Constructor.KdTreeImpl
(Set<MeshPoint> points) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
accept
(KdTreeVisitor visitor) Visits this tree.void
Method for adding independent point to existing tree.protected boolean
firstIsLessThanSecond
(javax.vecmath.Point3d v1, javax.vecmath.Point3d v2, int level) int
getDepth()
Return the length of the longest path.int
Return number of nodes in the k-d tree.getRoot()
Tree traversal - go to the "root" of the tree.protected KdNodeImpl
rearrangeLeafNodes
(javax.vecmath.Point3d point1, javax.vecmath.Point3d point2, javax.vecmath.Point3d point3, int level) toString()
-
Constructor Details
-
KdTreeImpl
Constructor.- Parameters:
points
- A set of individual mesh points. If no mesh points are provided, then an empty KD-tree is constructed (with the root node set to null).
-
KdTreeImpl
Constructor. If no mesh points (vertices) are provided, then an empty KD-tree is constructed (with the root node set to null). If multiple mesh facets share the same vertex, then they are stored efficiently in the same node of the KD-tree.- Parameters:
facets
- The list of mesh facets to be stored. Facets can share vertices.
-
-
Method Details
-
getRoot
Description copied from interface:KdTree
Tree traversal - go to the "root" of the tree. -
addNode
Description copied from interface:KdTree
Method for adding independent point to existing tree. The balance of the tree is not guaranteed after adding elements, it depends on the distribution of the added points. It can create long linear branches. In Poisson disk sub-sampling, where this method is used, it isn't a problem. -
toString
-
getNumNodes
public int getNumNodes()Description copied from interface:KdTree
Return number of nodes in the k-d tree.- Specified by:
getNumNodes
in interfaceKdTree
- Returns:
- number of nodes in the k-d tree
-
getDepth
public int getDepth()Description copied from interface:KdTree
Return the length of the longest path. -
accept
Description copied from interface:KdTree
Visits this tree. -
firstIsLessThanSecond
protected boolean firstIsLessThanSecond(javax.vecmath.Point3d v1, javax.vecmath.Point3d v2, int level) -
rearrangeLeafNodes
protected KdNodeImpl rearrangeLeafNodes(javax.vecmath.Point3d point1, javax.vecmath.Point3d point2, javax.vecmath.Point3d point3, int level)
-