Class SbXfBox3f


public class SbXfBox3f extends SbBox3f
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:
  • Constructor Details

    • SbXfBox3f

      public SbXfBox3f(SbXfBox3f copyFrom)
    • SbXfBox3f

      public SbXfBox3f(float[] components)
    • SbXfBox3f

      public SbXfBox3f()
      Constructor. The box is initially empty.
    • SbXfBox3f

      public SbXfBox3f(SbBox3f box)
      Constructor.
    • SbXfBox3f

      public SbXfBox3f(SbVec3f _min, SbVec3f _max)
      Constructor.
  • Method Details

    • setValue

      public SbXfBox3f setValue(float[] components, int startIndex)
      Overrides:
      setValue in class SbBox3f
    • setValue

      public void setValue(SbXfBox3f copyFrom)
    • getValue

      public float[] getValue()
      Overrides:
      getValue in class SbBox3f
    • setValue

      public SbXfBox3f setValue(float[] components)
      Overrides:
      setValue in class SbBox3f
    • project

      public SbBox3f project()
      Projects an SbXfBox3f to an SbBox3f.
    • transform

      public void transform(SbMatrix m)
      Transforms the box by the given matrix.
      Overrides:
      transform in class SbBox3f
    • extendBy

      public void extendBy(SbBox3f bb)
      Extends the box (if necessary) to contain the given box. If the box has had a non-identity transformation applied using the setTransform() method, the given SbBox3f is assumed to be in the transformed space.
      Overrides:
      extendBy in class SbBox3f
    • computeMaxDistance2

      public float computeMaxDistance2(SbVec3f p)
      Returns the squared maximum distance between a point and the 8 bounding box's vertices.
      Overrides:
      computeMaxDistance2 in class SbBox3f
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class SbBox3f
    • getClosestPoint

      public SbVec3f getClosestPoint(SbVec3f 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.)
      Overrides:
      getClosestPoint in class SbBox3f
    • toArray

      public static SbXfBox3f[] toArray(long nativeArray, long length)
    • setBounds

      public void setBounds(float xmin, float ymin, float zmin, float xmax, float ymax, float zmax)
      Sets the bounds of the box.
      Overrides:
      setBounds in class SbBox3f
    • setValue

      public SbXfBox3f setValue(SbXfBox3d xfbox3d)
      Sets value of the box from a double precision box.
    • getInverse

      public SbMatrix getInverse()
      Gets the inverse of the transformation on the box.
    • getBounds

      public float[] getBounds()
      Gets the bounds of the box.
      Overrides:
      getBounds in class SbBox3f
    • setBounds

      public void setBounds(SbVec3f _min, SbVec3f _max)
      Sets the bounds of the box.
      Overrides:
      setBounds in class SbBox3f
    • extendBy

      public void extendBy(SbVec3f pt)
      Extends the box (if necessary) to contain the given 3D point. If the box has had a non-identity transformation applied using the setTransform() 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));
      will result in a bounding box extending from (-1,-1,-1) to (0,0,0) in the bbox's local (untransformed) space.
      Overrides:
      extendBy in class SbBox3f
    • extendBy

      public void extendBy(SbXfBox3f bb)
      Extends the box (if necessary) to contain the given box.
    • intersect

      public boolean intersect(SbVec3f pt)
      Returns true if intersection of given point and this box is not empty.
      Overrides:
      intersect in class SbBox3f
    • getCenter

      public SbVec3f getCenter()
      Returns the center of the box.
      Overrides:
      getCenter in class SbBox3f
    • intersect

      public boolean intersect(SbBox3f bb)
      Returns true if intersection of given box and this box is not empty.
      Overrides:
      intersect in class SbBox3f
    • getTransform

      public SbMatrix 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 the makeEmpty() method. (This method only returns true if the maximum X value is less than the minimum X value.)
      Overrides:
      isEmpty in class SbBox3f
    • hasVolume

      public boolean hasVolume()
      Checks if the box has volume; i.e., all three dimensions have positive size.
      Overrides:
      hasVolume in class SbBox3f
    • getSpan

      public float[] getSpan(SbVec3f direction)
      Finds the extent of the box along a particular direction.
      Overrides:
      getSpan in class SbBox3f
    • getOrigin

      public float[] getOrigin()
      Returns origin (minimum point) of the box.
      Overrides:
      getOrigin in class SbBox3f
    • getMinMax

      public SbVec3f[] getMinMax()
      Gets the bounds of the box.
      Overrides:
      getMinMax in class SbBox3f
    • setTransform

      public void setTransform(SbMatrix m)
      Sets the transformation on the box.
    • makeEmpty

      public void makeEmpty()
      Sets the box to contain nothing.
      Overrides:
      makeEmpty in class SbBox3f
    • getVolume

      public float getVolume()
      Gives the volume of the box (0 for an empty box).
      Overrides:
      getVolume in class SbBox3f