Class TriangleKdNodeImpl
java.lang.Object
cz.fidentis.analyst.data.kdtree.impl.TriangleKdNodeImpl
- All Implemented Interfaces:
KdNode
,TriangleKdNode
,Serializable
!!!EXPERIMENTAL!!!
Node of a TriangleKdTree. Either an inner node or a leaf node.
Inner node stores its splitting plane and left, right, and parent nodes.
Leaf node stores
MeshTriangles
.- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionTriangleKdNodeImpl
(double split, int depth, TriangleKdNode parent) Inner node constructor.TriangleKdNodeImpl
(List<MeshTriangleBoundingBox> triangles, int depth, TriangleKdNode parent) Leaf constructor. -
Method Summary
Modifier and TypeMethodDescriptionint
getDepth()
Returns depth of the node in the tree.Returns a map of all mesh facets that share the stored vertex.Tree traversal - go to the "grater" child.Tree traversal - go to the "lesser" child.javax.vecmath.Point3d
Returns 3D location of vertices stored in this nodeGets parent of this node ornull
if it is the root node.double
getSplit()
Gets splitting plane position on axis according to depth.Gets triangles with their bounding boxes.Gets triangles stored in node.boolean
isLeaf()
Check if current node is leaf.setGreater
(KdNode greater) Set lesser node.Set lesser node.
-
Constructor Details
-
TriangleKdNodeImpl
Inner node constructor.- Parameters:
split
- Position of splitting plane in either x/y/z depending on depth.depth
- Depth of node in TriangleKdTree.parent
- ParentTriangleKdNode
ornull
if root node.
-
TriangleKdNodeImpl
public TriangleKdNodeImpl(List<MeshTriangleBoundingBox> triangles, int depth, TriangleKdNode parent) Leaf constructor.- Parameters:
triangles
- List of stored triangles with their bounding boxes.depth
- Depth of node in TriangleKdTree.parent
- ParentTriangleKdNode
ornull
if root node.
-
-
Method Details
-
getTriangles
Gets triangles stored in node.- Specified by:
getTriangles
in interfaceTriangleKdNode
- Returns:
- List of triangles stored in node. Empty list if node is not a leaf.
-
getTriangleBoundingBoxes
Gets triangles with their bounding boxes.- Specified by:
getTriangleBoundingBoxes
in interfaceTriangleKdNode
- Returns:
- List of triangles with their bounding boxes stored in node. Empty list if node is not a leaf.
-
getDepth
public int getDepth()Description copied from interface:KdNode
Returns depth of the node in the tree. -
getSplit
public double getSplit()Description copied from interface:TriangleKdNode
Gets splitting plane position on axis according to depth.- Specified by:
getSplit
in interfaceTriangleKdNode
- Returns:
- Splitting plane position on either x/y/z based on depth.
-
isLeaf
public boolean isLeaf()Description copied from interface:TriangleKdNode
Check if current node is leaf.- Specified by:
isLeaf
in interfaceTriangleKdNode
- Returns:
true
if it is a leaf node.false
otherwise.
-
getLocation
public javax.vecmath.Point3d getLocation()Description copied from interface:KdNode
Returns 3D location of vertices stored in this node- Specified by:
getLocation
in interfaceKdNode
- Returns:
- 3D location of vertices stored in this node
-
getParent
Description copied from interface:TriangleKdNode
Gets parent of this node ornull
if it is the root node.- Specified by:
getParent
in interfaceTriangleKdNode
- Returns:
- Parent node.
-
getLesser
Description copied from interface:KdNode
Tree traversal - go to the "lesser" child. -
getGreater
Description copied from interface:KdNode
Tree traversal - go to the "grater" child.- Specified by:
getGreater
in interfaceKdNode
- Returns:
- greater node, null if current node is leaf
-
setLesser
Description copied from interface:KdNode
Set lesser node. -
setGreater
Description copied from interface:KdNode
Set lesser node.- Specified by:
setGreater
in interfaceKdNode
- Parameters:
greater
- Node to be set as greater- Returns:
- current node
-
getFacets
Description copied from interface:KdNode
Returns a map of all mesh facets that share the stored vertex. Value in the map contains the index which the vertex is stored in the mesh facet.
-