Class SbBox2d


  • public class SbBox2d
    extends SbBasic
    2D box class. 2D box which has planes parallel to the major axes and is specified by two points (specified in double precision) 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 Also:
    SbBox3f, SbXfBox3f, SbBox2s, SbVec3f, SbVec2d, SbVec2s, SbMatrix
    • Field Summary

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

      Constructors 
      Constructor Description
      SbBox2d()
      Constructor for a 2D double box.
      SbBox2d​(double[] components)  
      SbBox2d​(double xmin, double ymin, double xmax, double ymax)
      Constructor for a 2D double box.
      SbBox2d​(SbBox2d copyFrom)  
      SbBox2d​(SbVec2d _min, SbVec2d _max)
      Constructor for a 2D double box.
    • Field Detail

      • array

        public final double[] array
    • Constructor Detail

      • SbBox2d

        public SbBox2d​(SbBox2d copyFrom)
      • SbBox2d

        public SbBox2d​(double[] components)
      • SbBox2d

        public SbBox2d()
        Constructor for a 2D double box. The box is initially empty.
      • SbBox2d

        public SbBox2d​(double xmin,
                       double ymin,
                       double xmax,
                       double ymax)
        Constructor for a 2D double box. xmin , ymin , xmax , and ymax are the bounds of the box.
      • SbBox2d

        public SbBox2d​(SbVec2d _min,
                       SbVec2d _max)
        Constructor for a 2D double box. m_min and m_max are the corners of the diagonal that define the box.
    • Method Detail

      • getValue

        public double[] getValue()
      • setValue

        public SbBox2d setValue​(double[] components)
      • setValue

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

        public void setValue​(SbBox2d copyFrom)
      • 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.)
      • makeEmpty

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

        public void setBounds​(double xmin,
                              double ymin,
                              double xmax,
                              double ymax)
        Sets the corners of the box.
      • toArray

        public static SbBox2d[] toArray​(long nativeArray,
                                        long length)
      • equals

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

        public boolean hasArea()
        Returns true if both dimensions of the box have positive size, and false otherwise.
      • getCenter

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

        public void setBounds​(SbVec2d _min,
                              SbVec2d _max)
        Sets the corners of the box.
      • getMax

        public SbVec2d getMax()
        Returns the maximum point of the box.
      • getBounds

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

        public boolean intersect​(SbVec2d pt)
        Returns true if the specified point intersects this box.
      • intersection

        public SbBox2d intersection​(SbBox2d box)
        Returns the intersection of the specified box with this box. Returned box is empty if there is no intersection.
      • extendBy

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

        public void extendBy​(SbBox2d r)
        Extends this box (if necessary) to contain the specified box.
      • getMinMax

        public SbVec2d[] getMinMax()
        Gets the corners of the box.
      • getSize

        public double[] getSize()
        Gets box size.
      • getAspectRatio

        public double getAspectRatio()
        Gets box aspect ratio.
      • intersect

        public boolean intersect​(SbBox2d bb)
        Returns true if the specified box intersects this box.
      • getClosestPoint

        public SbVec2d getClosestPoint​(SbVec2d 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 SbVec2d getMin()
        Returns the minimum point of the box.
      • getOrigin

        public double[] getOrigin()
        Gets box origin.