Package com.openinventor.inventor
Class SbBox2f
- java.lang.Object
-
- com.openinventor.inventor.SbBasic
-
- com.openinventor.inventor.SbBox2f
-
public class SbBox2f extends SbBasic
2D box class. 2D box which has planes parallel to the major axes and is specified by two points (specified as floating point) on a diagonal. This class is part of the standard Open Inventor datatype classes and is used as input and output to geometry operations.
-
-
Field Summary
Fields Modifier and Type Field Description float[]
array
-
Constructor Summary
Constructors Constructor Description SbBox2f()
Constructor for a 2D float box.SbBox2f(float[] components)
SbBox2f(float xmin, float ymin, float xmax, float ymax)
Constructor for a 2D float box.SbBox2f(SbBox2f copyFrom)
SbBox2f(SbVec2f _min, SbVec2f _max)
Constructor for a 2D float box.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object obj)
void
extendBy(SbBox2f r)
Extends this box (if necessary) to contain the specified box.void
extendBy(SbVec2f pt)
Extends this box (if necessary) to contain the specified point.float
getAspectRatio()
Gets box aspect ratio.float[]
getBounds()
Gets the corners of the box.SbVec2f
getCenter()
Returns the center of the box.SbVec2f
getClosestPoint(SbVec2f point)
Returns the closest point on the box to the given point.SbVec2f
getMax()
Returns the maximum point of the box.SbVec2f
getMin()
Returns the minimum point of the box.SbVec2f[]
getMinMax()
Gets the corners of the box.float[]
getOrigin()
Gets box origin.float[]
getSize()
Gets box size.float[]
getValue()
boolean
hasArea()
Returns true if both dimensions of the box have positive size, and false otherwise.boolean
intersect(SbBox2f bb)
Returns true if the specified box intersects this box.boolean
intersect(SbVec2f pt)
Returns true if the specified point intersects this box.SbBox2f
intersection(SbBox2f 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(float xmin, float ymin, float xmax, float ymax)
Sets the corners of the box.void
setBounds(SbVec2f _min, SbVec2f _max)
Sets the corners of the box.SbBox2f
setValue(float[] components)
SbBox2f
setValue(float[] components, int startIndex)
void
setValue(SbBox2f copyFrom)
static SbBox2f[]
toArray(long nativeArray, long length)
-
-
-
Constructor Detail
-
SbBox2f
public SbBox2f(SbBox2f copyFrom)
-
SbBox2f
public SbBox2f(float[] components)
-
SbBox2f
public SbBox2f()
Constructor for a 2D float box. The box is initially empty.
-
SbBox2f
public SbBox2f(float xmin, float ymin, float xmax, float ymax)
Constructor for a 2D float box. xmin , ymin , xmax , and ymax are the bounds of the box.
-
-
Method Detail
-
getValue
public float[] getValue()
-
setValue
public SbBox2f setValue(float[] components)
-
setValue
public SbBox2f setValue(float[] components, int startIndex)
-
setValue
public void setValue(SbBox2f 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 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.
-
setBounds
public void setBounds(float xmin, float ymin, float xmax, float ymax)
Sets the corners of the box.
-
toArray
public static SbBox2f[] toArray(long nativeArray, long length)
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
hasArea
public boolean hasArea()
Returns true if both dimensions of the box have positive size, and false otherwise.
-
getCenter
public SbVec2f getCenter()
Returns the center of the box.
-
getMax
public SbVec2f getMax()
Returns the maximum point of the box.
-
getBounds
public float[] getBounds()
Gets the corners of the box.
-
intersect
public boolean intersect(SbVec2f pt)
Returns true if the specified point intersects this box.
-
intersection
public SbBox2f intersection(SbBox2f box)
Returns the intersection of the specified box with this box. Returned box is empty if there is no intersection.
-
extendBy
public void extendBy(SbVec2f pt)
Extends this box (if necessary) to contain the specified point.
-
extendBy
public void extendBy(SbBox2f r)
Extends this box (if necessary) to contain the specified box.
-
getMinMax
public SbVec2f[] getMinMax()
Gets the corners of the box.
-
getSize
public float[] getSize()
Gets box size.
-
getAspectRatio
public float getAspectRatio()
Gets box aspect ratio.
-
intersect
public boolean intersect(SbBox2f bb)
Returns true if the specified box intersects this box.
-
getClosestPoint
public SbVec2f getClosestPoint(SbVec2f 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 SbVec2f getMin()
Returns the minimum point of the box.
-
getOrigin
public float[] getOrigin()
Gets box origin.
-
-