Class SbBox3d

java.lang.Object
com.openinventor.inventor.SbBasic
com.openinventor.inventor.SbBox3d
Direct Known Subclasses:
SbXfBox3d

public class SbBox3d 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 (see SoGetBoundingBoxAction).

See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    final double[]
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructor for a 3D double box.
    SbBox3d(double[] components)
     
    SbBox3d(double xmin, double ymin, double zmin, double xmax, double ymax, double zmax)
    Constructor for a 3D double box.
    SbBox3d(SbBox3d copyFrom)
     
    SbBox3d(SbVec3d _min, SbVec3d _max)
    Constructor for a 3D double box.
  • Method Summary

    Modifier and Type
    Method
    Description
    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.
    double[]
    Gets the corners of the box.
    Returns the center of the box.
    Returns the closest point on the box to the given point.
    Returns the maximum point of the box.
    Returns the minimum point of the box.
    Gets the corners of the box.
    double[]
    Gets box origin which is the same as the minimum corner of the box.
    double[]
    Gets box size.
    double[]
    getSpan(SbVec3d direction)
    Finds the span of a box along a specified direction.
    double[]
     
    double
    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.
    Returns the intersection of the specified box with this box.
    boolean
    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(double xmin, double ymin, double zmin, double xmax, double ymax, double zmax)
    Sets the corners of the box.
    void
    setBounds(SbVec3d _min, SbVec3d _max)
    Sets the corners of the box.
    setValue(double[] components)
     
    setValue(double[] components, int startIndex)
     
    void
    setValue(SbBox3d copyFrom)
     
    static SbBox3d[]
    toArray(long nativeArray, long length)
     
    void
    Transforms box by matrix, enlarging box to contain result.

    Methods inherited from class java.lang.Object

    getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • array

      public final double[] array
  • Constructor Details

    • SbBox3d

      public SbBox3d(SbBox3d copyFrom)
    • SbBox3d

      public SbBox3d(double[] components)
    • SbBox3d

      public SbBox3d()
      Constructor for a 3D double box. The box is initially empty.
    • SbBox3d

      public SbBox3d(double xmin, double ymin, double zmin, double xmax, double ymax, double zmax)
      Constructor for a 3D double box. xmin , ymin , zmin , xmax , ymax and zmax are the bounds of the box.
    • SbBox3d

      public SbBox3d(SbVec3d _min, SbVec3d _max)
      Constructor for a 3D double box. m_min and m_max are the corners of the diagonal that define the box.
  • Method Details

    • getValue

      public double[] getValue()
    • setValue

      public SbBox3d setValue(double[] components, int startIndex)
    • setValue

      public SbBox3d setValue(double[] components)
    • setValue

      public void setValue(SbBox3d copyFrom)
    • getSpan

      public double[] getSpan(SbVec3d 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(Object obj)
      Overrides:
      equals in class Object
    • toArray

      public static SbBox3d[] toArray(long nativeArray, long length)
    • transform

      public void transform(SbMatrixd m)
      Transforms box by matrix, enlarging box to contain result.
    • getVolume

      public double getVolume()
      Returns the volume of the box.
    • setBounds

      public void setBounds(double xmin, double ymin, double zmin, double xmax, double ymax, double zmax)
      Sets the corners of the box.
    • extendBy

      public void extendBy(SbVec3d pt)
      Extends this box (if necessary) to contain the specified point.
    • extendBy

      public void extendBy(SbBox3d bb)
      Extends this box (if necessary) to contain the specified box.
    • getCenter

      public SbVec3d getCenter()
      Returns the center of the box.
    • setBounds

      public void setBounds(SbVec3d _min, SbVec3d _max)
      Sets the corners of the box.
    • intersect

      public boolean intersect(SbVec3d pt)
      Returns true if the specified point intersects this box.
    • contains

      public boolean contains(SbBox3d bb)
      Returns true if the specified box is fully contained inside this box.
    • intersection

      public SbBox3d intersection(SbBox3d box)
      Returns the intersection of the specified box with this box. Returned box is empty if there is no intersection.
    • outside

      public int outside(SbMatrixd 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 and SoSeparator will handle this automatically for render culling).
    • intersect

      public boolean intersect(SbBox3d bb)
      Returns true if the specified box intersects this box.
    • getBounds

      public double[] getBounds()
      Gets the corners of the box.
    • makeEmpty

      public void makeEmpty()
      Makes an empty box.
    • getSize

      public double[] getSize()
      Gets box size.
    • 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 the makeEmpty() method. (This method only returns true if the maximum X value is less than the minimum X value.)
    • getOrigin

      public double[] getOrigin()
      Gets box origin which is the same as the minimum corner of the box.
    • getMinMax

      public SbVec3d[] getMinMax()
      Gets the corners of the box.
    • getMax

      public SbVec3d 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.
    • getClosestPoint

      public SbVec3d getClosestPoint(SbVec3d point)
      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.)
    • getMin

      public SbVec3d 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.