Package com.openinventor.inventor
Class SbBox3i32
- java.lang.Object
-
- com.openinventor.inventor.SbBasic
-
- com.openinventor.inventor.SbBox3i32
-
public class SbBox3i32 extends SbBasic
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 (seeSoGetBoundingBoxAction
).
-
-
Field Summary
Fields Modifier and Type Field Description int[]
array
-
Constructor Summary
Constructors Constructor Description SbBox3i32()
Constructor for a 3D integer32 box.SbBox3i32(int[] components)
SbBox3i32(int xmin, int ymin, int zmin, int xmax, int ymax, int zmax)
Constructor for a 3D integer32 box.SbBox3i32(SbBox3i32 copyFrom)
SbBox3i32(SbBox3s box)
Constructor given anSbBox3s
(adapter).SbBox3i32(SbVec3i32 _min, SbVec3i32 _max)
Constructor for a 3D integer32 box.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
contains(SbBox3i32 bb)
Returns true if the specified box is fully contained inside this box.boolean
equals(java.lang.Object obj)
void
extendBy(SbBox3i32 bb)
Extends this box (if necessary) to contain the specified box.void
extendBy(SbVec3f pt)
Extends this box (if necessary) to contain the specified point.int[]
getBounds()
Gets the corners of the box.SbVec3f
getCenter()
Returns the center of the box.SbVec3f
getClosestPoint(SbVec3f point)
Returns the closest point on the box to the given point.SbVec3i32
getMax()
Returns the maximum point of the box.SbVec3i32
getMin()
Returns the minimum point of the box.SbVec3i32[]
getMinMax()
Gets the corners of the box.int[]
getOrigin()
Gets box origin which is the same as the minimum corner of the box.SbVec3i32
getSize()
Gets box size.float[]
getSpan(SbVec3f direction)
Finds the span of a box along a specified direction.int[]
getValue()
float
getVolume()
Returns the volume of the box.boolean
hasVolume()
Returns true if all three dimensions of the box have positive size, and false otherwise.boolean
intersect(SbBox3i32 bb)
Returns true if the specified box intersects this box.boolean
intersect(SbVec3f pt)
Returns true if the specified point intersects this box.boolean
intersect(SbVec3i32 pt)
Returns true if the specified point intersects this box.SbBox3i32
intersection(SbBox3i32 box)
Returns the intersection of the specified box with this box.boolean
isEmpty()
Returns true if the box is empty, and false otherwise.void
makeEmpty()
Makes an empty box.int
outside(SbMatrix MVP)
Returns true if bounding box is completely outside the view-volume defined by the model+view+projection matrix given.void
setBounds(int xmin, int ymin, int zmin, int xmax, int ymax, int zmax)
Sets the corners of the box.void
setBounds(SbVec3i32 _min, SbVec3i32 _max)
Sets the corners of the box.SbBox3i32
setValue(int[] components)
SbBox3i32
setValue(int[] components, int startIndex)
void
setValue(SbBox3i32 copyFrom)
static SbBox3i32[]
toArray(long nativeArray, long length)
void
transform(SbMatrix m)
Transforms box by matrix, enlarging box to contain result.
-
-
-
Constructor Detail
-
SbBox3i32
public SbBox3i32(SbBox3i32 copyFrom)
-
SbBox3i32
public SbBox3i32(int[] components)
-
SbBox3i32
public SbBox3i32()
Constructor for a 3D integer32 box. The box is initially empty.
-
SbBox3i32
public SbBox3i32(int xmin, int ymin, int zmin, int xmax, int ymax, int zmax)
Constructor for a 3D integer32 box. xmin , ymin , zmin , xmax , ymax and zmax are the bounds of the box.
-
-
Method Detail
-
setValue
public SbBox3i32 setValue(int[] components, int startIndex)
-
setValue
public void setValue(SbBox3i32 copyFrom)
-
setValue
public SbBox3i32 setValue(int[] components)
-
getValue
public int[] getValue()
-
getSpan
public float[] getSpan(SbVec3f direction)
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.
-
hasVolume
public boolean hasVolume()
Returns true if all three dimensions of the box have positive size, and false otherwise.
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
toArray
public static SbBox3i32[] toArray(long nativeArray, long length)
-
transform
public void transform(SbMatrix m)
Transforms box by matrix, enlarging box to contain result.
-
getVolume
public float getVolume()
Returns the volume of the box.
-
outside
public int outside(SbMatrix MVP)
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).
-
extendBy
public void extendBy(SbVec3f pt)
Extends this box (if necessary) to contain the specified point.
-
extendBy
public void extendBy(SbBox3i32 bb)
Extends this box (if necessary) to contain the specified box.
-
setBounds
public void setBounds(int xmin, int ymin, int zmin, int xmax, int ymax, int zmax)
Sets the corners of the box.
-
getCenter
public SbVec3f getCenter()
Returns the center of the box.
-
intersection
public SbBox3i32 intersection(SbBox3i32 box)
Returns the intersection of the specified box with this box. Returned box is empty if there is no intersection.
-
intersect
public boolean intersect(SbVec3i32 pt)
Returns true if the specified point intersects this box.
-
intersect
public boolean intersect(SbBox3i32 bb)
Returns true if the specified box intersects this box.
-
intersect
public boolean intersect(SbVec3f pt)
Returns true if the specified point intersects this box.
-
contains
public boolean contains(SbBox3i32 bb)
Returns true if the specified box is fully contained inside this box.
-
getMax
public SbVec3i32 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.
-
getSize
public SbVec3i32 getSize()
Gets box size.
-
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.)
-
getMin
public SbVec3i32 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.
-
getBounds
public int[] getBounds()
Gets the corners of the box.
-
getMinMax
public SbVec3i32[] getMinMax()
Gets the corners of the box.
-
getOrigin
public int[] getOrigin()
Gets box origin which is the same as the minimum corner of the box.
-
-