Package com.openinventor.inventor
Class SbXfBox3f
java.lang.Object
com.openinventor.inventor.SbBasic
com.openinventor.inventor.SbBox3f
com.openinventor.inventor.SbXfBox3f
3D box with an associated transformation matrix.
A 3D box with an arbitrary transformation applied. This class is useful when a box will be transformed frequently; if an
SbBox3f
is used for this purpose it will expand each time it is transformed in order to keep itself axis-aligned. Transformations can be accumulated on an SbXfBox3f
without expanding the box, and after all transformations have been done, the box can be expanded to an axis-aligned box if necessary.
- See Also:
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfloat
Returns the squared maximum distance between a point and the 8 bounding box's vertices.boolean
void
Extends the box (if necessary) to contain the given box.void
Extends the box (if necessary) to contain the given 3D point.void
Extends the box (if necessary) to contain the given box.float[]
Gets the bounds of the box.Returns the center of the box.getClosestPoint
(SbVec3f point) Returns the closest point on the box to the given point.Gets the inverse of the transformation on the box.SbVec3f[]
Gets the bounds of the box.float[]
Returns origin (minimum point) of the box.float[]
Finds the extent of the box along a particular direction.Gets the transformation on the box.float[]
getValue()
float
Gives the volume of the box (0 for an empty box).boolean
Checks if the box has volume; i.e., all three dimensions have positive size.boolean
Returns true if intersection of given box and this box is not empty.boolean
Returns true if intersection of given point and this box is not empty.boolean
isEmpty()
Returns true if the box is empty, and false otherwise.void
Sets the box to contain nothing.project()
void
setBounds
(float xmin, float ymin, float zmin, float xmax, float ymax, float zmax) Sets the bounds of the box.void
Sets the bounds of the box.void
Sets the transformation on the box.setValue
(float[] components) setValue
(float[] components, int startIndex) Sets value of the box from a double precision box.void
static SbXfBox3f[]
toArray
(long nativeArray, long length) void
Transforms the box by the given matrix.Methods inherited from class com.openinventor.inventor.SbBox3f
contains, getMax, getMin, getSize, intersection, outside, setValue, triangleBoxOverlap
-
Constructor Details
-
SbXfBox3f
-
SbXfBox3f
public SbXfBox3f(float[] components) -
SbXfBox3f
public SbXfBox3f()Constructor. The box is initially empty. -
SbXfBox3f
Constructor. -
SbXfBox3f
Constructor.
-
-
Method Details
-
setValue
-
setValue
-
getValue
public float[] getValue() -
setValue
-
project
-
transform
Transforms the box by the given matrix. -
extendBy
Extends the box (if necessary) to contain the given box. If the box has had a non-identity transformation applied using thesetTransform()
method, the givenSbBox3f
is assumed to be in the transformed space. -
computeMaxDistance2
Returns the squared maximum distance between a point and the 8 bounding box's vertices.- Overrides:
computeMaxDistance2
in classSbBox3f
-
equals
-
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.)- Overrides:
getClosestPoint
in classSbBox3f
-
toArray
-
setBounds
public void setBounds(float xmin, float ymin, float zmin, float xmax, float ymax, float zmax) Sets the bounds of the box. -
setValue
Sets value of the box from a double precision box. -
getInverse
Gets the inverse of the transformation on the box. -
getBounds
public float[] getBounds()Gets the bounds of the box. -
setBounds
Sets the bounds of the box. -
extendBy
Extends the box (if necessary) to contain the given 3D point. If the box has had a non-identity transformation applied using thesetTransform()
method, the point is assumed to be in the transformed space. For example, the following code sequence:SbXfBox3f bbox = new SbXfBox3f(); bbox.extendBy(new SbVec3f(0, 0, 0)); SbMatrix trans = new SbMatrix(); trans.setTranslate(new SbVec3f(1, 1, 1)); bbox.setTransform(trans); bbox.extendBy(new SbVec3f(0, 0, 0)); -
extendBy
Extends the box (if necessary) to contain the given box. -
intersect
Returns true if intersection of given point and this box is not empty. -
getCenter
Returns the center of the box. -
intersect
Returns true if intersection of given box and this box is not empty. -
getTransform
Gets the transformation on the 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()Checks if the box has volume; i.e., all three dimensions have positive size. -
getSpan
Finds the extent of the box along a particular direction. -
getOrigin
public float[] getOrigin()Returns origin (minimum point) of the box. -
getMinMax
Gets the bounds of the box. -
setTransform
Sets the transformation on the box. -
makeEmpty
public void makeEmpty()Sets the box to contain nothing. -
getVolume
public float getVolume()Gives the volume of the box (0 for an empty box).
-