|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectmaspack.geometry.BVNode
maspack.geometry.OBB
public class OBB
Nested Class Summary | |
---|---|
static class |
OBB.Method
Method used to generate an OBB from a set of boundables |
Field Summary | |
---|---|
static double |
defaultTolerance
|
Fields inherited from interface maspack.render.GLRenderable |
---|
TRANSLUCENT, TWO_DIMENSIONAL |
Constructor Summary | |
---|---|
OBB()
|
|
OBB(double wx,
double wy,
double wz)
|
|
OBB(double wx,
double wy,
double wz,
RigidTransform3d X)
|
|
OBB(MeshBase mesh)
|
|
OBB(Vector3d widths,
RigidTransform3d X)
|
Method Summary | |
---|---|
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. |
Vector3d |
getHalfWidths()
Gets the half-widths for this OBB. |
void |
getHalfWidths(Vector3d halfWidths)
Sets the half-widths for this OBB. |
double |
getRadius()
Returns an approximate "radius" for this bounding volume. |
void |
getSortedAxes(Vector3d[] axes)
Returns the axes of the box, sorted in order from largest to smallest. |
RigidTransform3d |
getTransform()
Returns the transform associated with this OBB. |
void |
getTransform(RigidTransform3d XObbToRef)
Gets the transform associated with this OBB. |
void |
getWidths(Vector3d widths)
Gets the widths for this OBB. |
boolean |
intersectsLine(double[] lam,
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)
Prepare for rendering, and potentially add itself to a list to be drawn by a GLRenderer. |
void |
render(GLRenderer renderer,
int flags)
Render this object using Open GL via the JOGL. |
void |
set(Boundable[] elems,
int num,
double margin,
OBB.Method method)
|
void |
set(MeshBase mesh,
double margin,
OBB.Method method)
Sets this OBB to contain the points for a mesh. |
void |
set(Point3d[] pnts,
double margin,
OBB.Method method)
|
void |
setHalfWidths(Vector3d hw)
|
void |
setTransform(RigidTransform3d XObbToRef)
Sets the transform associated with this OBB. |
void |
setWidths(double wx,
double wy,
double wz)
Sets the widths for this OBB. |
void |
setWidths(Vector3d widths)
Sets the widths for this OBB. |
void |
update(double margin)
|
void |
updateBounds(Point3d pmin,
Point3d pmax)
Update the minimum and maximum points for this object. |
Methods inherited from class maspack.geometry.BVNode |
---|
addChild, getDepth, getElements, getFirstChild, getNext, getNumber, getNumElements, getParent, getRenderHints, isLeaf, numChildren, setElements, setNumber, setParent |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static double defaultTolerance
Constructor Detail |
---|
public OBB()
public OBB(double wx, double wy, double wz, RigidTransform3d X)
public OBB(double wx, double wy, double wz)
public OBB(Vector3d widths, RigidTransform3d X)
public OBB(MeshBase mesh)
Method Detail |
---|
public double getRadius()
BVNode
getRadius
in class BVNode
public void getCenter(Vector3d center)
BVNode
getCenter
in class BVNode
center
- returns to center pointpublic void setWidths(double wx, double wy, double wz)
wx
- new width value for the 'x' principal axiswy
- new width value for the 'y' principal axiswz
- new width value for the 'z' principal axispublic void setHalfWidths(Vector3d hw)
public void setWidths(Vector3d widths)
widths
- specifies new width values for this OBBpublic void getWidths(Vector3d widths)
widths
- returns the width values for this OBBpublic void getHalfWidths(Vector3d halfWidths)
halfWidths
- returns the half-width values for this OBBpublic Vector3d getHalfWidths()
public void setTransform(RigidTransform3d XObbToRef)
XObbToRef
- new transform valuepublic void getTransform(RigidTransform3d XObbToRef)
XObbToRef
- returns the transform valuepublic RigidTransform3d getTransform()
public void set(MeshBase mesh, double margin, OBB.Method method)
mesh
- mesh to fit the OBB tomargin
- extra distance by with the OBB should be grown. If
less than 0, a default margin is computed.method
- public void set(Point3d[] pnts, double margin, OBB.Method method)
public void getSortedAxes(Vector3d[] axes)
public void set(Boundable[] elems, int num, double margin, OBB.Method method)
public boolean containsPoint(Point3d pnt)
BVNode
containsPoint
in class BVNode
pnt
- point to be tested
public boolean intersectsSphere(Point3d pnt, double r)
BVNode
intersectsSphere
in class BVNode
pnt
- center point of the spherer
- radius of the sphere
public boolean intersectsLine(double[] lam, Point3d origin, Vector3d dir, double min, double max)
BVNode
x = origin + s dirThe line can be given finite bounds by specifying maximum and minimum bounds for s.
intersectsLine
in class BVNode
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 value
public void update(double margin)
public boolean isContained(Boundable[] boundables, double tol)
BVNode
isContained
in class BVNode
boundables
- set of boundable elements to checktol
- specifies the minimum amount by which each element
must be insidepublic double distanceToPoint(Point3d pnt)
BVNode
distanceToPoint
in class BVNode
pnt
- point to check distance for
public double distanceAlongLine(Point3d origin, Vector3d dir, double min, double max)
distanceAlongLine
in class BVNode
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 value
public void updateBounds(Point3d pmin, Point3d pmax)
GLRenderable
pmin
- minimum pointpmax
- maximum pointpublic void render(GLRenderer renderer, int flags)
GLRenderable
renderer
- renderer object which is used to perform the rendering. Provides pointers
to GL and GLU, along with helper functions.flags
- supplies flags that may be used to control different
aspects of the rendering. Flags are defined in GLRenderer
and currently include
GLRenderer.SELECTED
,
GLRenderer.VERTEX_COLORING
,
GLRenderer.HSV_COLOR_INTERPOLATION
,
GLRenderer.SORT_FACES
, and
GLRenderer.CLEAR_MESH_DISPLAY_LISTS
.public void prerender(RenderList list)
GLRenderable
public boolean intersectsLineSegment(Point3d p1, Point3d p2)
BVNode
intersectsLineSegment
in class BVNode
p1
- first segment end pointp2
- second segment end point
public boolean intersectsPlane(Vector3d n, double d)
BVNode
n^T x = d
intersectsPlane
in class BVNode
n
- normal direction of the planed
- dot product offset
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |