Class SbXfBox3d


  • public class SbXfBox3d
    extends SbBox3d
    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 SbXfBox3d 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:
    SbBox3f, SbBox2f, SbBox2s, SbVec3d, SbVec2f, SbVec2s, SbMatrix, SoGetBoundingBoxAction
    • Constructor Detail

      • SbXfBox3d

        public SbXfBox3d​(SbXfBox3d copyFrom)
      • SbXfBox3d

        public SbXfBox3d​(double[] components)
      • SbXfBox3d

        public SbXfBox3d​(SbBox3d box)
        Constructor.
      • SbXfBox3d

        public SbXfBox3d​(SbVec3d _min,
                         SbVec3d _max)
        Constructor.
      • SbXfBox3d

        public SbXfBox3d()
        Constructor. The box is initially empty.
    • Method Detail

      • getValue

        public double[] getValue()
        Overrides:
        getValue in class SbBox3d
      • setValue

        public void setValue​(SbXfBox3d copyFrom)
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class SbBox3d
      • setTransform

        public void setTransform​(SbMatrixd m)
        Sets the transformation on the box.
      • transform

        public void transform​(SbMatrixd m)
        Transforms the box by the given matrix.
        Overrides:
        transform in class SbBox3d
      • getInverse

        public SbMatrixd getInverse()
        Gets the inverse of the transformation on the box.
      • getTransform

        public SbMatrixd getTransform()
        Gets the transformation on the box.
      • toArray

        public static SbXfBox3d[] toArray​(long nativeArray,
                                          long length)
      • getSize

        public double[] getSize()
        Returns size of the box.
        Overrides:
        getSize in class SbBox3d
      • setValue

        public SbXfBox3d setValue​(SbXfBox3f xfbox3f)
        Sets value of the box from a single precision box.
      • getVolume

        public double getVolume()
        Gives the volume of the box (0 for an empty box).
        Overrides:
        getVolume in class SbBox3d
      • intersect

        public boolean intersect​(SbBox3d bb)
        Returns true if intersection of this XfBox3d and the given Box3d is not empty.
        Overrides:
        intersect in class SbBox3d
      • getBounds

        public double[] getBounds()
        Gets the bounds of the box.
        Overrides:
        getBounds in class SbBox3d
      • getOrigin

        public double[] getOrigin()
        Returns origin (minimum point) of the box.
        Overrides:
        getOrigin in class SbBox3d
      • setBounds

        public void setBounds​(double xmin,
                              double ymin,
                              double zmin,
                              double xmax,
                              double ymax,
                              double zmax)
        Sets the bounds of the box.
        Overrides:
        setBounds in class SbBox3d
      • intersect

        public boolean intersect​(SbVec3d pt)
        Returns true if intersection of given point and this box is not empty.
        Overrides:
        intersect in class SbBox3d
      • extendBy

        public void extendBy​(SbVec3d 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:
         SbXfBox3d 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 SbBox3d
      • hasVolume

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

        public double[] getSpan​(SbVec3d direction)
        Finds the extent of the box along a particular direction.
        Overrides:
        getSpan in class SbBox3d
      • extendBy

        public void extendBy​(SbXfBox3d bb)
        Extends the box (if necessary) to contain the given box.
      • makeEmpty

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

        public void extendBy​(SbBox3d bb)
        Extends the box (if necessary) to contain the given box.
        Overrides:
        extendBy in class SbBox3d
      • 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 SbBox3d