public abstract static class BoundingVolumeHierarchy.Node
extends java.lang.Object
Node
is an abstract base type used to represent a node in a Bounding Volume Hierarchy (BVH).Modifier | Constructor and Description |
---|---|
protected |
Node(int depth)
Constructs a new
Node instance. |
Modifier and Type | Method and Description |
---|---|
abstract void |
addBounds(java.util.Collection<Point3F> point3Fs)
Adds the maximum and minimum bounds to
point3Fs . |
Point3F |
getCenter()
Returns a
Point3F with the center of the bounds of this Node instance. |
float |
getCenterX()
Returns the X-coordinate of the center of the bounds of this
Node instance. |
float |
getCenterY()
Returns the Y-coordinate of the center of the bounds of this
Node instance. |
float |
getCenterZ()
Returns the Z-coordinate of the center of the bounds of this
Node instance. |
int |
getDepth()
Returns the depth of this
Node instance. |
Point3F |
getMaximum()
Returns a
Point3F with the maximum bound of this Node instance. |
float |
getMaximumX()
Returns the X-coordinate of the maximum bound of this
Node instance. |
float |
getMaximumY()
Returns the Y-coordinate of the maximum bound of this
Node instance. |
float |
getMaximumZ()
Returns the Z-coordinate of the maximum bound of this
Node instance. |
Point3F |
getMinimum()
Returns a
Point3F with the minimum bound of this Node instance. |
float |
getMinimumX()
Returns the X-coordinate of the minimum bound of this
Node instance. |
float |
getMinimumY()
Returns the Y-coordinate of the minimum bound of this
Node instance. |
float |
getMinimumZ()
Returns the Z-coordinate of the minimum bound of this
Node instance. |
abstract int |
getSize()
Returns the size of this
Node instance. |
abstract boolean |
isLeaf()
Returns
true if, and only if, this Node is a leaf node, false otherwise. |
void |
setMaximum(float maximumX,
float maximumY,
float maximumZ)
Sets the maximum bound for this
Node instance. |
void |
setMinimum(float minimumX,
float minimumY,
float minimumZ)
Sets the minimum bound for this
Node instance. |
java.util.List<BoundingVolumeHierarchy.Node> |
toList()
Returns a
List with all Node s added in a depth-first order. |
abstract 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. |
abstract java.lang.String |
toString(int indentation)
Returns a
String representation of this Node instance. |
protected Node(int depth)
Node
instance.depth
- the depth of this Node
public final java.util.List<BoundingVolumeHierarchy.Node> toList()
List
with all Node
s added in a depth-first order.
Calling this method is equivalent to toList(new ArrayList<>())
.
List
with all Node
s added in a depth-first orderpublic abstract 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.
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 final Point3F getCenter()
Point3F
with the center of the bounds of this Node
instance.Point3F
with the center of the bounds of this Node
instancepublic final Point3F getMaximum()
Point3F
with the maximum bound of this Node
instance.Point3F
with the maximum bound of this Node
instancepublic final Point3F getMinimum()
Point3F
with the minimum bound of this Node
instance.Point3F
with the minimum bound of this Node
instancepublic abstract java.lang.String toString(int indentation)
String
representation of this Node
instance.indentation
- the number of indentations to useString
representation of this Node
instancepublic abstract boolean isLeaf()
true
if, and only if, this Node
is a leaf node, false
otherwise.true
if, and only if, this Node
is a leaf node, false
otherwisepublic final float getCenterX()
Node
instance.Node
instancepublic final float getCenterY()
Node
instance.Node
instancepublic final float getCenterZ()
Node
instance.Node
instancepublic final float getMaximumX()
Node
instance.Node
instancepublic final float getMaximumY()
Node
instance.Node
instancepublic final float getMaximumZ()
Node
instance.Node
instancepublic final float getMinimumX()
Node
instance.Node
instancepublic final float getMinimumY()
Node
instance.Node
instancepublic final float getMinimumZ()
Node
instance.Node
instancepublic final int getDepth()
Node
instance.Node
instancepublic abstract int getSize()
Node
instance.Node
instancepublic abstract void addBounds(java.util.Collection<Point3F> point3Fs)
point3Fs
.
If point3Fs
is null
, a NullPointerException
will be thrown.
point3Fs
- a Collection
of Point3F
sjava.lang.NullPointerException
- thrown if, and only if, point3Fs
is null
public final void setMaximum(float maximumX, float maximumY, float maximumZ)
Node
instance.maximumX
- the X-coordinate of the maximum boundmaximumY
- the Y-coordinate of the maximum boundmaximumZ
- the Z-coordinate of the maximum boundpublic final void setMinimum(float minimumX, float minimumY, float minimumZ)
Node
instance.minimumX
- the X-coordinate of the minimum boundminimumY
- the Y-coordinate of the minimum boundminimumZ
- the Z-coordinate of the minimum bound