Class SbBox2s


  • public class SbBox2s
    extends SbBasic
    2D box class. 2D box which has planes parallel to the major axes and is specified by two points (specified with short integers) 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, SbBox2f, SbVec3f, SbVec2f, SbVec2s, SbMatrix
    • Field Summary

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

      Constructors 
      Constructor Description
      SbBox2s()
      Constructor for a 2D integer box.
      SbBox2s​(short[] components)  
      SbBox2s​(short xmin, short ymin, short xmax, short ymax)
      Constructor for a 2D integer box.
      SbBox2s​(SbBox2s copyFrom)  
      SbBox2s​(SbVec2s _min, SbVec2s _max)
      Constructor for a 2D integer box.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object obj)  
      void extendBy​(SbBox2s r)
      Extends this box (if necessary) to contain the specified box.
      void extendBy​(SbVec2s pt)
      Extends this box (if necessary) to contain the specified point.
      float getAspectRatio()
      Returns aspect ratio (ratio of width to height) of box.
      short[] getBounds()
      Gets the corners of the box.
      SbVec2s getMax()
      Returns the maximum point of the box.
      SbVec2s getMin()
      Returns the minimum point of the box.
      SbVec2s[] getMinMax()
      Gets the corners of the box.
      short[] getOrigin()
      Returns origin (minimum point) of box.
      short[] getSize()
      Returns box size.
      short[] getValue()  
      boolean hasArea()
      Returns true if both dimensions of the box have positive size, and false otherwise.
      boolean intersect​(SbBox2s bb)
      Returns true if the specified box intersects this box.
      boolean intersect​(SbVec2s pt)
      Returns true if the specified point intersects this box.
      SbBox2s intersection​(SbBox2s 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.
      void setBounds​(short xmin, short ymin, short xmax, short ymax)
      Sets the corners of the box.
      void setBounds​(SbVec2s _min, SbVec2s _max)
      Sets the corners of the box.
      SbBox2s setValue​(short[] components)  
      SbBox2s setValue​(short[] components, int startIndex)  
      void setValue​(SbBox2s copyFrom)  
      static SbBox2s[] toArray​(long nativeArray, long length)  
      • Methods inherited from class java.lang.Object

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

      • array

        public final short[] array
    • Constructor Detail

      • SbBox2s

        public SbBox2s​(short[] components)
      • SbBox2s

        public SbBox2s​(SbBox2s copyFrom)
      • SbBox2s

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

        public SbBox2s()
        Constructor for a 2D integer box. The box is initially empty.
      • SbBox2s

        public SbBox2s​(SbVec2s _min,
                       SbVec2s _max)
        Constructor for a 2D integer box. m_min and m_max are the corners of the diagonal that defines the box.
    • Method Detail

      • setValue

        public SbBox2s setValue​(short[] components,
                                int startIndex)
      • setValue

        public SbBox2s setValue​(short[] components)
      • getValue

        public short[] getValue()
      • setValue

        public void setValue​(SbBox2s 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.
      • toArray

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

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

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

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

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

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

        public short[] getBounds()
        Gets the corners of the box.
      • getMax

        public SbVec2s getMax()
        Returns the maximum point of the box.
      • intersection

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

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

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

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

        public short[] getSize()
        Returns box size.
      • getAspectRatio

        public float getAspectRatio()
        Returns aspect ratio (ratio of width to height) of box.
      • getMinMax

        public SbVec2s[] getMinMax()
        Gets the corners of the box.
      • getMin

        public SbVec2s getMin()
        Returns the minimum point of the box.
      • getOrigin

        public short[] getOrigin()
        Returns origin (minimum point) of box.