Package cz.fidentis.analyst.data.kdtree
Interface KdTree
- All Superinterfaces:
Serializable
- All Known Implementing Classes:
KdTreeImpl
k-D tree for storing vertices (
MeshPoint
s) of triangular (MeshFacet
s).
Multiple mesh facets can be stored in a single kd-tree. In this case,
vertices that are shared across multiple facets (have the same 3D location)
are shared in the same node of the kd-tree.-
Method Summary
Modifier and TypeMethodDescriptionvoid
accept
(KdTreeVisitor visitor) Visits this tree.void
Method for adding independent point to existing tree.static KdTree
Creates a new k-D tree.static KdTree
Creates a new k-D tree.static KdTree
create
(Collection<MeshFacet> facets) Creates a new k-D tree.static KdTree
Creates a new k-D tree.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.
-
Method Details
-
create
Creates a new k-D tree.- 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).- Returns:
- a new k-D tree
-
create
Creates a new k-D tree. If no mesh points (vertices) are provided, then an empty k-D tree is constructed (with the root node set to null).- Parameters:
mesh
- Mesh model- Returns:
- a new k-D tree
-
create
Creates a new k-D tree. If no mesh points (vertices) are provided, then an empty k-D tree is constructed (with the root node set to null).- Parameters:
facet
- Mesh facet- Returns:
- a new k-D tree
-
create
Creates a new k-D tree. If no mesh points (vertices) are provided, then an empty k-D 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 k-D tree.- Parameters:
facets
- The list of mesh facets to be stored. Facets can share vertices.- Returns:
- a new k-D tree
-
getRoot
KdNode getRoot()Tree traversal - go to the "root" of the tree.- Returns:
- root node of the tree
-
addNode
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.- Parameters:
meshPoint
- point to add
-
getNumNodes
int getNumNodes()Return number of nodes in the k-d tree.- Returns:
- number of nodes in the k-d tree
-
getDepth
int getDepth()Return the length of the longest path.- Returns:
- Return the length of the longest path.
-
accept
Visits this tree.- Parameters:
visitor
- Visitor
-