public static final class BoundingVolumeHierarchy.LeafNode extends BoundingVolumeHierarchy.Node
LeafNode
is a BoundingVolumeHierarchy.Node
implementation that represents a leaf node in a Bounding Volume Hierarchy (BVH).Constructor and Description |
---|
LeafNode(int depth)
Constructs a new
LeafNode instance. |
Modifier and Type | Method and Description |
---|---|
void |
addBounds(java.util.Collection<Point3F> point3Fs)
Adds the maximum and minimum bounds to
point3Fs . |
void |
addTriangle(Triangle triangle)
Adds
triangle to this LeafNode instance. |
boolean |
equals(java.lang.Object object)
Compares
object to this LeafNode instance for equality. |
int |
getSize()
Returns the size of this
LeafNode instance. |
java.util.List<Triangle> |
getTriangles()
Returns a
List with the Triangle s currently added. |
int |
hashCode()
Returns a hash code for this
LeafNode instance. |
boolean |
isLeaf()
Returns
true . |
void |
removeTriangle(Triangle triangle)
Removes
triangle from this LeafNode instance. |
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 LeafNode instance. |
java.lang.String |
toString(int indentation)
Returns a
String representation of this LeafNode instance. |
getCenter, getCenterX, getCenterY, getCenterZ, getDepth, getMaximum, getMaximumX, getMaximumY, getMaximumZ, getMinimum, getMinimumX, getMinimumY, getMinimumZ, setMaximum, setMinimum, toList
public LeafNode(int depth)
LeafNode
instance.depth
- the depth of this LeafNode
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.List<Triangle> getTriangles()
List
with the Triangle
s currently added.
Modifying the returned List
will affect this LeafNode
instance.
List
with the Triangle
s currently addedpublic java.lang.String toString()
String
representation of this LeafNode
instance.
Calling this method is equivalent to toString(0)
.
toString
in class java.lang.Object
String
representation of this LeafNode
instancepublic java.lang.String toString(int indentation)
String
representation of this LeafNode
instance.toString
in class BoundingVolumeHierarchy.Node
indentation
- the number of indentations to useString
representation of this LeafNode
instancepublic boolean equals(java.lang.Object object)
object
to this LeafNode
instance for equality.
Returns true
if, and only if, object
is an instance of LeafNode
, and their respective values are equal, false
otherwise.
equals
in class java.lang.Object
object
- the Object
to compare to this LeafNode
instance for equalitytrue
if, and only if, object
is an instance of LeafNode
, and their respective values are equal, false
otherwisepublic boolean isLeaf()
true
.isLeaf
in class BoundingVolumeHierarchy.Node
true
public int getSize()
LeafNode
instance.getSize
in class BoundingVolumeHierarchy.Node
LeafNode
instancepublic int hashCode()
LeafNode
instance.hashCode
in class java.lang.Object
LeafNode
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 addTriangle(Triangle triangle)
triangle
to this LeafNode
instance.
If triangle
is null
, a NullPointerException
will be thrown.
triangle
- the Triangle
to addjava.lang.NullPointerException
- thrown if, and only if, triangle
is null