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 Node s 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, toList
public TreeNode(int depth)
TreeNode
instance.depth
- the depth of this TreeNode
public java.util.List<BoundingVolumeHierarchy.Node> toList(java.util.List<BoundingVolumeHierarchy.Node> nodes)
List
with all Node
s added in a depth-first order.
If nodes
is null
, a NullPointerException
will be thrown.
toList
in class BoundingVolumeHierarchy.Node
nodes
- the List
to add Node
s to and returnList
with all Node
s added in a depth-first orderjava.lang.NullPointerException
- thrown if, and only if, nodes
is null
public java.util.Optional<BoundingVolumeHierarchy.Node> getLeft()
Optional
with the optional left BoundingVolumeHierarchy.Node
.Optional
with the optional left Node
public java.util.Optional<BoundingVolumeHierarchy.Node> getRight()
Optional
with the optional right BoundingVolumeHierarchy.Node
.Optional
with the optional right Node
public java.lang.String toString()
String
representation of this TreeNode
instance.
Calling this method is equivalent to toString(0)
.
toString
in class java.lang.Object
String
representation of this TreeNode
instancepublic java.lang.String toString(int indentation)
String
representation of this TreeNode
instance.toString
in class BoundingVolumeHierarchy.Node
indentation
- 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.Object
object
- 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.Node
false
public int getSize()
TreeNode
instance.getSize
in class BoundingVolumeHierarchy.Node
TreeNode
instancepublic int hashCode()
TreeNode
instance.hashCode
in class java.lang.Object
TreeNode
instancepublic void addBounds(java.util.Collection<Point3F> point3Fs)
point3Fs
.
If point3Fs
is null
, a NullPointerException
will be thrown.
addBounds
in class BoundingVolumeHierarchy.Node
point3Fs
- a Collection
of Point3F
sjava.lang.NullPointerException
- thrown if, and only if, point3Fs
is null
public void setLeft(BoundingVolumeHierarchy.Node left)
BoundingVolumeHierarchy.Node
.left
- the left Node
, which may be null
public void setRight(BoundingVolumeHierarchy.Node right)
BoundingVolumeHierarchy.Node
.right
- the right Node
, which may be null