public abstract class BVNode extends java.lang.Object implements IsRenderable
TRANSPARENT, TWO_DIMENSIONAL
Constructor and Description |
---|
BVNode() |
Modifier and Type | Method and Description |
---|---|
void |
addChild(BVNode child)
Adds a child volume to this bounding volume.
|
abstract boolean |
containsPoint(Point3d pnt)
Returns true if this bounding volume contains a prescribed point.
|
abstract double |
distanceAlongLine(Point3d origin,
Vector3d dir,
double min,
double max)
Returns the distance of this bounding volume along a line from a
point.
|
abstract double |
distanceToPoint(Point3d pnt)
Returns the distance of a point to this bounding volume, or 0
if the point is on or inside it.
|
abstract void |
getCenter(Vector3d center)
Returns a center point for this bounding volume.
|
int |
getDepth()
Returns the depth of this bounding volume within a tree.
|
Boundable[] |
getElements()
Returns the boundable elements directly contained by this bounding
volume.
|
BVNode |
getFirstChild()
Returns the first child volume, if any, associated with this bounding
volume
|
BVNode |
getNext()
Returns the next sibling volume, if any, associated with the bounding
volume.
|
int |
getNumber()
Returns the number of this bounding volume.
|
int |
getNumElements()
Returns the number of boundable elements directly contained by this
bounding volume.
|
BVNode |
getParent()
Gets the parent volume, if any, for this bounding volume.
|
abstract double |
getRadius()
Returns an approximate "radius" for this bounding volume.
|
int |
getRenderHints()
Returns a bit code giving rendering hints about this renderable.
|
abstract boolean |
intersectsLine(double[] lam,
Point3d origin,
Vector3d dir,
double min,
double max)
Returns true if this bounding volume intersects a line.
|
abstract boolean |
intersectsLineSegment(Point3d p1,
Point3d p2)
Returns true if this bounding volume intersects a line segment.
|
abstract boolean |
intersectsPlane(Vector3d n,
double d)
Returns true if this bounding volume intersects a plane
described by
|
abstract boolean |
intersectsSphere(Point3d center,
double r)
Returns true if this bounding volume intersects a sphere.
|
abstract boolean |
isContained(Boundable[] elements,
double tol)
Returns true if an entire set of elements is contained within this
bounding volume.
|
boolean |
isLeaf()
Returns true if this bounding volume is a leaf node; i.e.,
if it has no children.
|
int |
numChildren()
Returns the number of child volumes contained by this bounding volume.
|
void |
setElements(Boundable[] elements)
Sets the boundable elements directly contained by this bounding
volume.
|
void |
setNumber(int num)
Sets the number of this bounding volume.
|
void |
setParent(BVNode parent)
Sets the parent volume for this bounding volume.
|
boolean |
updateFor(Boundable b,
double margin) |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
prerender, render, updateBounds
public void addChild(BVNode child)
child
- child to be addedpublic BVNode getFirstChild()
public BVNode getNext()
public int getNumber()
public void setNumber(int num)
num
- numberpublic abstract double getRadius()
public abstract void getCenter(Vector3d center)
center
- returns to center pointpublic int numChildren()
public Boundable[] getElements()
public int getNumElements()
public void setElements(Boundable[] elements)
elements
- boundable elements to be containedpublic BVNode getParent()
public void setParent(BVNode parent)
parent
- parent volumepublic boolean isLeaf()
public abstract boolean containsPoint(Point3d pnt)
pnt
- point to be testedpublic abstract boolean intersectsLine(double[] lam, Point3d origin, Vector3d dir, double min, double max)
x = origin + s dirThe line can be given finite bounds by specifying maximum and minimum bounds for s.
lam
- if non-null, returns the lower and upper values of s
that define the intersection regionorigin
- originating point for the linedir
- direction of the linemin
- minimum s value for the line, or -infinity if there
is no minimum valuemax
- maximum s value for the line, or +infinity if there
is no maximum valuepublic abstract boolean intersectsSphere(Point3d center, double r)
center
- center point of the spherer
- radius of the spherepublic abstract boolean intersectsPlane(Vector3d n, double d)
n^T x = d
n
- normal direction of the planed
- dot product offsetpublic abstract boolean intersectsLineSegment(Point3d p1, Point3d p2)
p1
- first segment end pointp2
- second segment end pointpublic abstract double distanceToPoint(Point3d pnt)
pnt
- point to check distance forpublic abstract double distanceAlongLine(Point3d origin, Vector3d dir, double min, double max)
x = origin + s dirThe line can be given finite bounds by specifying maximum and minimum bounds for s.
origin
- originating point for the linedir
- direction of the linemin
- minimum s value for the line, or -infinity if there
is no minimum valuemax
- maximum s value for the line, or +infinity if there
is no maximum valuepublic abstract boolean isContained(Boundable[] elements, double tol)
elements
- set of boundable elements to checktol
- specifies the minimum amount by which each element
must be insidepublic int getRenderHints()
TRANSPARENT
and
TWO_DIMENSIONAL
.getRenderHints
in interface IsRenderable
public int getDepth()
public boolean updateFor(Boundable b, double margin)