Package com.openinventor.inventor
Class SbBox2s
java.lang.Object
com.openinventor.inventor.SbBasic
com.openinventor.inventor.SbBox2s
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:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
void
Extends this box (if necessary) to contain the specified box.void
Extends this box (if necessary) to contain the specified point.float
Returns aspect ratio (ratio of width to height) of box.short[]
Gets the corners of the box.getMax()
Returns the maximum point of the box.getMin()
Returns the minimum point of the box.SbVec2s[]
Gets the corners of the box.short[]
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
Returns true if the specified box intersects this box.boolean
Returns true if the specified point intersects this box.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
Makes an empty box.void
setBounds
(short xmin, short ymin, short xmax, short ymax) Sets the corners of the box.void
Sets the corners of the box.setValue
(short[] components) setValue
(short[] components, int startIndex) void
static SbBox2s[]
toArray
(long nativeArray, long length)
-
Field Details
-
array
public final short[] array
-
-
Constructor Details
-
SbBox2s
public SbBox2s(short[] components) -
SbBox2s
-
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
Constructor for a 2D integer box. m_min and m_max are the corners of the diagonal that defines the box.
-
-
Method Details
-
setValue
-
setValue
-
getValue
public short[] getValue() -
setValue
-
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 themakeEmpty()
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
-
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
-
setBounds
Sets the corners of the box. -
extendBy
Extends this box (if necessary) to contain the specified point. -
getBounds
public short[] getBounds()Gets the corners of the box. -
getMax
Returns the maximum point of the box. -
intersection
Returns the intersection of the specified box with this box. Returned box is empty if there is no intersection. -
intersect
Returns true if the specified box intersects this box. -
extendBy
Extends this box (if necessary) to contain the specified box. -
intersect
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
Gets the corners of the box. -
getMin
Returns the minimum point of the box. -
getOrigin
public short[] getOrigin()Returns origin (minimum point) of box.
-