Package com.openinventor.inventor
Class SbBox3f
java.lang.Object
com.openinventor.inventor.SbBasic
com.openinventor.inventor.SbBox3f
- Direct Known Subclasses:
SbXfBox3f
3D box class.
3D box which has planes parallel to the major axes and is specified by two points on a diagonal. This class is part of the standard Open Inventor datatype classes and is used as input and output to geometry operations (see
SoGetBoundingBoxAction
).
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfloat
Returns the squared maximum distance between a point and the 8 bounding box's vertices.boolean
Returns true if the specified box is fully contained inside this box.boolean
void
Extends this box (if necessary) to contain the specified box.void
Extends this box (if necessary) to contain the specified point.float[]
Gets the corners of the box.Returns the center of the box.getClosestPoint
(SbVec3f point) Returns the closest point on the box to the given point.getMax()
Returns the maximum point of the box.getMin()
Returns the minimum point of the box.SbVec3f[]
Gets the corners of the box.float[]
Gets box origin which is the same as the minimum corner of the box.getSize()
Gets box size.float[]
Finds the span of a box along a specified direction.float[]
getValue()
float
Returns the volume of the box.boolean
Returns true if all three dimensions of the box have positive size, and false otherwise.boolean
Returns true if the specified box intersects this box.boolean
Returns true if the specified point intersects this box.intersection
(SbBox3f box) Returns the intersection of the specified box with this box.boolean
isEmpty()
Returns true if the box is empty, and false otherwise.void
Makes an empty box.int
Returns true if bounding box is completely outside the view-volume defined by the model+view+projection matrix given.void
setBounds
(float xmin, float ymin, float zmin, float xmax, float ymax, float zmax) Sets the corners of the box.void
Sets the corners of the box.setValue
(float[] components) setValue
(float[] components, int startIndex) void
static SbBox3f[]
toArray
(long nativeArray, long length) void
Transforms box by matrix, enlarging box to contain result.boolean
triangleBoxOverlap
(SbVec3f u0, SbVec3f u1, SbVec3f u2) Return true if the given triangle intersects the bounding box.
-
Field Details
-
array
public final float[] array
-
-
Constructor Details
-
SbBox3f
-
SbBox3f
public SbBox3f(float[] components) -
SbBox3f
public SbBox3f(float xmin, float ymin, float zmin, float xmax, float ymax, float zmax) Constructor for a 3D float box. xmin , ymin , zmin , xmax , ymax and zmax are the bounds of the box. -
SbBox3f
public SbBox3f()Constructor for a 3D float box. The box is initially empty. -
SbBox3f
Constructor for a 3D float box. m_min and m_max are the corners of the diagonal that define the box.
-
-
Method Details
-
setValue
-
setValue
-
getValue
public float[] getValue() -
setValue
-
computeMaxDistance2
Returns the squared maximum distance between a point and the 8 bounding box's vertices. -
transform
Transforms box by matrix, enlarging box to contain result. -
extendBy
Extends this box (if necessary) to contain the specified box. -
getVolume
public float getVolume()Returns the volume of the box. -
triangleBoxOverlap
Return true if the given triangle intersects the bounding box. Note that intersection considers the whole box, not just the border. Therefore a triangle completely inside the box will return true. -
toArray
-
equals
-
getSpan
Finds the span of a box along a specified direction. The span is the total distance the box occupies along a given direction. The total distance is returned in the form of a minimum and maximum distance from the origin of each of the corners of the box along the given direction. The difference between these two values is the span. -
outside
Returns true if bounding box is completely outside the view-volume defined by the model+view+projection matrix given. "cullBits" keeps track of which view-volume clipping planes the box is completely inside of; if a 'parent' bounding box of this bounding box was found to be completely inside the left/right clipping planes, the low bit of cullBits will be set to zero, and this routine will not test this box against those planes. When cullBits is zero, it is a waste of time to call this function! Before calling this the first time, set cullBits to 7 (SoGLRenderAction
andSoSeparator
will handle this automatically for render culling). -
getMax
Returns the maximum point of the box. The maximum point is the corner of the box with the highest X, Y, and Z values. -
setBounds
public void setBounds(float xmin, float ymin, float zmin, float xmax, float ymax, float zmax) Sets the corners of the box. -
getMin
Returns the minimum point of the box. The minimum point is the corner of the box with the lowest X, Y, and Z values. -
setBounds
Sets the corners of the box. -
contains
Returns true if the specified box is fully contained inside this box. -
intersect
Returns true if the specified point intersects this box. -
extendBy
Extends this box (if necessary) to contain the specified point. -
intersect
Returns true if the specified box intersects this box. -
intersection
Returns the intersection of the specified box with this box. Returned box is empty if there is no intersection. -
getCenter
Returns the center of the box. -
makeEmpty
public void makeEmpty()Makes an empty box. -
isEmpty
public boolean isEmpty()Returns true if the box is empty, and false otherwise. Note: Setting the box to all zeros does not make it "empty". Use themakeEmpty()
method. (This method only returns true if the maximum X value is less than the minimum X value.) -
hasVolume
public boolean hasVolume()Returns true if all three dimensions of the box have positive size, and false otherwise. -
getSize
Gets box size. -
getMinMax
Gets the corners of the box. -
getBounds
public float[] getBounds()Gets the corners of the box. -
getClosestPoint
Returns the closest point on the box to the given point. (Returns the point on the center of the Z face if passed the center.) -
getOrigin
public float[] getOrigin()Gets box origin which is the same as the minimum corner of the box.
-