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 Triangles 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 Nodes 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, toListpublic LeafNode(int depth)
LeafNode instance.depth - the depth of this LeafNodepublic 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.List<Triangle> getTriangles()
List with the Triangles currently added.
Modifying the returned List will affect this LeafNode instance.
List with the Triangles 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.ObjectString representation of this LeafNode instancepublic java.lang.String toString(int indentation)
String representation of this LeafNode instance.toString in class BoundingVolumeHierarchy.Nodeindentation - 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.Objectobject - 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.Nodetruepublic int getSize()
LeafNode instance.getSize in class BoundingVolumeHierarchy.NodeLeafNode instancepublic int hashCode()
LeafNode instance.hashCode in class java.lang.ObjectLeafNode 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 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