public static final class BoundingVolumeHierarchy.TreeNode extends BoundingVolumeHierarchy.Node
TreeNode is a BoundingVolumeHierarchy.Node implementation that represents a tree node in a Bounding Volume Hierarchy (BVH).| Constructor and Description |
|---|
TreeNode(int depth)
Constructs a new
TreeNode instance. |
| Modifier and Type | Method and Description |
|---|---|
void |
addBounds(java.util.Collection<Point3F> point3Fs)
Adds the maximum and minimum bounds to
point3Fs. |
boolean |
equals(java.lang.Object object)
Compares
object to this TreeNode instance for equality. |
java.util.Optional<BoundingVolumeHierarchy.Node> |
getLeft()
Returns an
Optional with the optional left BoundingVolumeHierarchy.Node. |
java.util.Optional<BoundingVolumeHierarchy.Node> |
getRight()
Returns an
Optional with the optional right BoundingVolumeHierarchy.Node. |
int |
getSize()
Returns the size of this
TreeNode instance. |
int |
hashCode()
Returns a hash code for this
TreeNode instance. |
boolean |
isLeaf()
Returns
false. |
void |
setLeft(BoundingVolumeHierarchy.Node left)
Sets the left
BoundingVolumeHierarchy.Node. |
void |
setRight(BoundingVolumeHierarchy.Node right)
Sets the right
BoundingVolumeHierarchy.Node. |
java.util.List<BoundingVolumeHierarchy.Node> |
toList(java.util.List<BoundingVolumeHierarchy.Node> nodes)
Returns a
List with all Nodes added in a depth-first order. |
java.lang.String |
toString()
Returns a
String representation of this TreeNode instance. |
java.lang.String |
toString(int indentation)
Returns a
String representation of this TreeNode instance. |
getCenter, getCenterX, getCenterY, getCenterZ, getDepth, getMaximum, getMaximumX, getMaximumY, getMaximumZ, getMinimum, getMinimumX, getMinimumY, getMinimumZ, setMaximum, setMinimum, toListpublic TreeNode(int depth)
TreeNode instance.depth - the depth of this TreeNodepublic java.util.List<BoundingVolumeHierarchy.Node> toList(java.util.List<BoundingVolumeHierarchy.Node> nodes)
List with all Nodes added in a depth-first order.
If nodes is null, a NullPointerException will be thrown.
toList in class BoundingVolumeHierarchy.Nodenodes - the List to add Nodes to and returnList with all Nodes added in a depth-first orderjava.lang.NullPointerException - thrown if, and only if, nodes is nullpublic java.util.Optional<BoundingVolumeHierarchy.Node> getLeft()
Optional with the optional left BoundingVolumeHierarchy.Node.Optional with the optional left Nodepublic java.util.Optional<BoundingVolumeHierarchy.Node> getRight()
Optional with the optional right BoundingVolumeHierarchy.Node.Optional with the optional right Nodepublic java.lang.String toString()
String representation of this TreeNode instance.
Calling this method is equivalent to toString(0).
toString in class java.lang.ObjectString representation of this TreeNode instancepublic java.lang.String toString(int indentation)
String representation of this TreeNode instance.toString in class BoundingVolumeHierarchy.Nodeindentation - the number of indentations to useString representation of this TreeNode instancepublic boolean equals(java.lang.Object object)
object to this TreeNode instance for equality.
Returns true if, and only if, object is an instance of TreeNode, and their respective values are equal, false otherwise.
equals in class java.lang.Objectobject - the Object to compare to this TreeNode instance for equalitytrue if, and only if, object is an instance of TreeNode, and their respective values are equal, false otherwisepublic boolean isLeaf()
false.isLeaf in class BoundingVolumeHierarchy.Nodefalsepublic int getSize()
TreeNode instance.getSize in class BoundingVolumeHierarchy.NodeTreeNode instancepublic int hashCode()
TreeNode instance.hashCode in class java.lang.ObjectTreeNode instancepublic void addBounds(java.util.Collection<Point3F> point3Fs)
point3Fs.
If point3Fs is null, a NullPointerException will be thrown.
addBounds in class BoundingVolumeHierarchy.Nodepoint3Fs - a Collection of Point3Fsjava.lang.NullPointerException - thrown if, and only if, point3Fs is nullpublic void setLeft(BoundingVolumeHierarchy.Node left)
BoundingVolumeHierarchy.Node.left - the left Node, which may be nullpublic void setRight(BoundingVolumeHierarchy.Node right)
BoundingVolumeHierarchy.Node.right - the right Node, which may be null