public class AABB extends BVNode
TRANSPARENT, TWO_DIMENSIONAL| Constructor and Description |
|---|
AABB() |
AABB(double minx,
double miny,
double minz,
double maxx,
double maxy,
double maxz) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
containsPoint(Point3d pnt)
Returns true if this bounding volume contains a prescribed point.
|
double |
distanceAlongLine(Point3d origin,
Vector3d dir,
double min,
double max)
Code is modified from "An Efficient and Robust Ray-Box Intersection
Algorithm", Amy Williams, Steve Barrus, R.
|
double |
distanceToPoint(Point3d pnt)
Returns the distance of a point to this bounding volume, or 0
if the point is on or inside it.
|
void |
getCenter(Vector3d center)
Returns a center point for this bounding volume.
|
void |
getHalfWidths(Vector3d hw) |
double |
getRadius()
Returns an approximate "radius" for this bounding volume.
|
boolean |
intersectsLine(double[] dists,
Point3d origin,
Vector3d dir,
double min,
double max)
Returns true if this bounding volume intersects a line.
|
boolean |
intersectsLineSegment(Point3d p1,
Point3d p2)
Returns true if this bounding volume intersects a line segment.
|
boolean |
intersectsPlane(Vector3d n,
double d)
Returns true if this bounding volume intersects a plane
described by
|
boolean |
intersectsSphere(Point3d pnt,
double r)
Returns true if this bounding volume intersects a sphere.
|
boolean |
isContained(Boundable[] boundables,
double tol)
Returns true if an entire set of elements is contained within this
bounding volume.
|
void |
prerender(RenderList list)
Called prior to rendering to allow this object to update the internal
state required for rendering (such as by caching rendering coordinates).
|
void |
render(Renderer renderer,
int flags)
Render this object using the functionality of the supplied
Renderer. |
void |
scale(double s)
Scales this bounding volume node by the indicated scale factor
s. |
void |
set(Boundable[] elementList,
int nelems,
double margin) |
void |
setMaximums(double maxx,
double maxy,
double maxz) |
void |
setMinimums(double minx,
double miny,
double minz) |
boolean |
update(double margin)
Update node
|
void |
updateBounds(Vector3d min,
Vector3d max)
Update the minimum and maximum points for this object.
|
void |
updateForAABB(AABB aabb,
double margin)
Grow this AABB if necessary to accommodate anothor aabb.
|
boolean |
updateForPoint(Point3d pnt,
double margin) |
addChild, getDepth, getElements, getFirstChild, getNext, getNumber, getNumElements, getParent, getRenderHints, isLeaf, numChildren, setElements, setNumber, setParent, updateForpublic AABB()
public AABB(double minx,
double miny,
double minz,
double maxx,
double maxy,
double maxz)
public double getRadius()
BVNodepublic void getCenter(Vector3d center)
BVNodepublic void getHalfWidths(Vector3d hw)
public void setMinimums(double minx,
double miny,
double minz)
public void setMaximums(double maxx,
double maxy,
double maxz)
public boolean containsPoint(Point3d pnt)
BVNodecontainsPoint in class BVNodepnt - point to be testedpublic boolean intersectsSphere(Point3d pnt, double r)
BVNodeintersectsSphere in class BVNodepnt - center point of the spherer - radius of the spherepublic boolean intersectsLine(double[] dists,
Point3d origin,
Vector3d dir,
double min,
double max)
BVNodex = origin + s dirThe line can be given finite bounds by specifying maximum and minimum bounds for s.
intersectsLine in class BVNodedists - 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 boolean intersectsPlane(Vector3d n, double d)
BVNoden^T x = d
intersectsPlane in class BVNoden - normal direction of the planed - dot product offsetpublic boolean intersectsLineSegment(Point3d p1, Point3d p2)
BVNodeintersectsLineSegment in class BVNodep1 - first segment end pointp2 - second segment end pointpublic void set(Boundable[] elementList, int nelems, double margin)
public boolean updateForPoint(Point3d pnt, double margin)
public boolean update(double margin)
BVNodemargin - supplied margin around boundarypublic boolean isContained(Boundable[] boundables, double tol)
BVNodeisContained in class BVNodeboundables - set of boundable elements to checktol - specifies the minimum amount by which each element
must be insidepublic void updateForAABB(AABB aabb, double margin)
aabb - AABB that should fit inside this boxmargin - additional tolerance marginpublic double distanceToPoint(Point3d pnt)
BVNodedistanceToPoint in class BVNodepnt - point to check distance forpublic double distanceAlongLine(Point3d origin, Vector3d dir, double min, double max)
distanceAlongLine in class BVNodeorigin - 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 void updateBounds(Vector3d min, Vector3d max)
IsRenderablemin - minimum pointmax - maximum pointpublic void prerender(RenderList list)
IsRenderablelist.addIfVisible (obj);
for each of the objects in question.list - list of objects to be renderedpublic void render(Renderer renderer, int flags)
IsRenderableRenderer.renderer - provides the functionality used to perform the rendering.flags - flags that may be used to control different
aspects of the rendering. Flags are defined in Renderer
and currently include
Renderer.HIGHLIGHT and
Renderer.SORT_FACES.public void scale(double s)
s. This can be used to enlarge a volume to
accommodate a margin.s - scaling factor