|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.tensegrity.graphics.BoundingBox
The BoundingBox class keeps all datas and methods needed to
implement a bounding box functionality.
At the actual state of development the BoundingBox class is
restricted to 2d space but it will be enhanced so that it can also be used
with 3d space. With this enhancement the documentation will be updated too.
| Field Summary | |
int[] |
coordsX
An Array holding the X-axis (left, right) coordinates of this BoundingBox instance. |
int[] |
coordsY
An Array holding the Y-axis (top, bottom) coordinates of this BoundingBox instance. |
static int |
LEFT_TOP
Constant speciying the left coordinate of array coordsX or
the top coordinate of array coordsX. |
static int |
RIGHT_BOTTOM
Constant speciying the right coordinate of array coordsX or
the bottom coordinate of array coordsX. |
static int |
X1
Constant specifying a coordinate component in either the coordinate component array coordsX or in the coordinate component
array coordsY |
static int |
X2
Constant specifying a coordinate component in either the coordinate component array coordsX or in the coordinate component
array coordsY |
static int |
Y1
Constant specifying a coordinate component in either the coordinate component array coordsX or in the coordinate component
array coordsY |
static int |
Y2
Constant specifying a coordinate component in either the coordinate component array coordsX or in the coordinate component
array coordsY |
| Constructor Summary | |
BoundingBox()
Constructor for BoundingBox. |
|
BoundingBox(Boundary boundary)
Constructor specifying the boundaries. |
|
BoundingBox(BoundingBox bBox)
Deepcopy constructor speifying the BoundingBox to be copied. |
|
BoundingBox(Coordinate c1,
Coordinate c2)
Constructor specifying the coordinates to be used. |
|
BoundingBox(int left,
int top,
int right,
int bottom)
Constructor specifying the corner points of this BoundingBox. |
|
| Method Summary | |
boolean |
contains(BoundingBox bBox)
Returns a boolean that indicates whether the given
BoundingBox lies within this
BoundingBox or not. |
boolean |
contains(int x,
int y)
TODO : comment |
boolean |
contains(int x1,
int y1,
int x2,
int y2)
Returns a boolean that indicates whether the
bounding box given by x1, y1, x2
and y2 lies completely within this BoundingBox
or not. |
boolean |
contains(java.awt.Point pt)
Returns a boolean that indicates whether the
Point given by pt lies within this
BoundingBox or not. |
static BoundingBox |
createMaxMinBBox()
|
static BoundingBox |
createMinMaxBBox()
|
boolean |
equalHeight(BoundingBox bBox)
Returns a boolean that indicates whether the height of the
given BoundingBox is equal to the height of this
BoundingBox. |
boolean |
equals(java.lang.Object o)
|
boolean |
equalSize(BoundingBox bBox)
Returns a boolean that indicates whether the width and the
height of the given BoundingBox are equal to the width and
the height of this BoundingBox. |
boolean |
equalWidth(BoundingBox bBox)
Returns a boolean that indicates whether the width of the
given BoundingBox is equal to the width of this
BoundingBox. |
java.awt.Point |
getCenter()
Returns the center coordinate of the BoundingBox instance as
a Point. |
double |
getCenterDX()
Returns the current center in x direction of the BoundingBox
instance as a double. |
double |
getCenterDY()
Returns the current center in y direction of the BoundingBox
instance as a double. |
int |
getCenterX()
Returns the current center in x direction of the BoundingBox
instance as an int. |
int |
getCenterY()
Returns the current center in y direction of the BoundingBox
instance as an int. |
int |
getHeight()
TODO : comment |
Coordinate |
getLocation()
TODO : comment |
Size |
getSize()
TODO : comment |
int |
getWidth()
TODO : comment |
int |
hashCode()
|
boolean |
intersect(BoundingBox bbox)
Returns a boolean that indicates whether this
BoundingBox intersects the BoundingBox given by
bbox or not. |
boolean |
intersect(java.awt.Insets insets)
Returns a boolean that indicates whether the
BoundingBox intersects the Insets given by
insets or not. |
BoundingBox |
intersection_createnew(int left,
int top,
int right,
int bottom)
|
void |
intersection(java.awt.Insets insets)
Creates the intersaction of the Insets instance given by
insets and the BoundingBox instance. |
void |
intersection(int left,
int top,
int right,
int bottom)
|
boolean |
isEmpty()
Returns a boolean that indicates whether the
BoundingBox is empty or not. |
static boolean |
isMaxMinBBox(BoundingBox bbox)
|
static boolean |
isMinMaxBBox(BoundingBox bbox)
|
void |
movePosition(int deltaX,
int deltaY)
TODO : comment |
void |
normalize()
TODO : comment |
void |
set(Boundary boundary)
TODO : comment |
void |
set(BoundingBox bBox)
TODO : comment |
void |
set(Coordinate c1,
Coordinate c2)
TODO : comment |
void |
setHeight(int height)
TODO : comment |
void |
setLeft(int left)
TODO : comment |
void |
setLocation(Coordinate coordinate)
TODO : comment |
void |
setPosition(int left,
int top)
TODO : comment |
void |
setSize(Size size)
TODO : comment |
void |
setTop(int top)
TODO : comment |
void |
setWidth(int width)
TODO : comment |
Boundary |
toBoundary()
TODO : comment |
static Boundary |
toBoundary(BoundingBox box)
TODO : comment |
java.lang.String |
toString()
TODO : comment |
BoundingBox |
union_createnew(int left,
int top,
int right,
int bottom)
|
void |
union(java.awt.Insets insets)
Creates the union of the Insets instance given by
insets and the BoundingBox instance. |
void |
union(int left,
int top,
int right,
int bottom)
|
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static final int X1
coordsX or in the coordinate component
array coordsY
public static final int Y1
coordsX or in the coordinate component
array coordsY
public static final int X2
coordsX or in the coordinate component
array coordsY
public static final int Y2
coordsX or in the coordinate component
array coordsY
public static final int LEFT_TOP
coordsX or
the top coordinate of array coordsX.
public static final int RIGHT_BOTTOM
coordsX or
the bottom coordinate of array coordsX.
public int[] coordsX
BoundingBox instance.
public int[] coordsY
BoundingBox instance.
| Constructor Detail |
public BoundingBox()
public BoundingBox(Coordinate c1,
Coordinate c2)
c1 - the first Coordinate.c2 - the second Coordinate.
public BoundingBox(int left,
int top,
int right,
int bottom)
BoundingBox.
left - the upper left x-coordinate.top - the left top y-coordinate.right - the bottom right x-coordinate.bottom - the right bottom y-coordinate.public BoundingBox(BoundingBox bBox)
BoundingBox to be copied.
bBox - the BoundingBox to be copied.public BoundingBox(Boundary boundary)
boundary - the Boundary to be set.| Method Detail |
public void setLeft(int left)
left - public void setTop(int top)
top -
public void setPosition(int left,
int top)
public void movePosition(int deltaX,
int deltaY)
public Coordinate getLocation()
public void setLocation(Coordinate coordinate)
public void set(Coordinate c1,
Coordinate c2)
public void set(BoundingBox bBox)
public void set(Boundary boundary)
public int getWidth()
public void setWidth(int width)
public int getHeight()
public void setHeight(int height)
public Size getSize()
public void setSize(Size size)
public boolean contains(int x,
int y)
public boolean contains(java.awt.Point pt)
boolean that indicates whether the
Point given by pt lies within this
BoundingBox or not.
pt - the point to check.
BoundingBox.public boolean contains(BoundingBox bBox)
boolean that indicates whether the given
BoundingBox lies within this
BoundingBox or not.
bBox - the BoundingBox to check.
BoundingBox is contained by this Boundary.
public boolean contains(int x1,
int y1,
int x2,
int y2)
boolean that indicates whether the
bounding box given by x1, y1, x2
and y2 lies completely within this BoundingBox
or not.
Boundary is contained by this Boundary or notpublic boolean equalWidth(BoundingBox bBox)
boolean that indicates whether the width of the
given BoundingBox is equal to the width of this
BoundingBox.
bBox - the BoundingBox to check; may not be
null.
BoundingBox has the same width as this
Boundary.public boolean equalHeight(BoundingBox bBox)
boolean that indicates whether the height of the
given BoundingBox is equal to the height of this
BoundingBox.
bBox - the BoundingBox to check; may not be
null.
BoundingBox has the same height as this
BoundingBox.public boolean equalSize(BoundingBox bBox)
boolean that indicates whether the width and the
height of the given BoundingBox are equal to the width and
the height of this BoundingBox.
bBox - the BoundingBox to check; may not be
null.
BoundingBox has the same width and height as this
BoundingBox.public int getCenterX()
BoundingBox
instance as an int.
BoundingBox in x direction.public int getCenterY()
BoundingBox
instance as an int.
BoundingBox in y direction.public double getCenterDX()
BoundingBox
instance as a double.
BoundingBox in x direction.public double getCenterDY()
BoundingBox
instance as a double.
BoundingBox in x direction.public java.awt.Point getCenter()
BoundingBox instance as
a Point.
BoundingBox.
public void union(int left,
int top,
int right,
int bottom)
public BoundingBox union_createnew(int left,
int top,
int right,
int bottom)
public void union(java.awt.Insets insets)
Insets instance given by
insets and the BoundingBox instance. The union
means that the origin coordinate and the ending coordinate are adjusted
to the smallest rectangle that encapsulates the rectangle of the
BoundingBox instance and the given Insets
instance.
insets - the Insets instance to create a union with.
public void intersection(int left,
int top,
int right,
int bottom)
public BoundingBox intersection_createnew(int left,
int top,
int right,
int bottom)
public void intersection(java.awt.Insets insets)
Insets instance given by
insets and the BoundingBox instance. The
intersection is the smalles rectangle that is encapsulated by the
BoundingBox instance and the given Insets
instance. Notice that the intersection rectangle can be empty.
insets - the Insets instance to create an intersection
with.public boolean isEmpty()
boolean that indicates whether the
BoundingBox is empty or not. Empty means, that the
BoundingBox has a width of zero or a height of zero.
BoundingBox
is empty.public boolean intersect(java.awt.Insets insets)
boolean that indicates whether the
BoundingBox intersects the Insets given by
insets or not.
insets - the Insets to check for intersection.
Insets
intersects the BoundingBox.public boolean intersect(BoundingBox bbox)
boolean that indicates whether this
BoundingBox intersects the BoundingBox given by
bbox or not.
bbox - the BoundingBox to check for intersection.
BoundingBox intersects this BoundingBox.public void normalize()
public Boundary toBoundary()
public java.lang.String toString()
public static Boundary toBoundary(BoundingBox box)
public int hashCode()
Object.hashCode()public boolean equals(java.lang.Object o)
Object.equals(java.lang.Object)public static final BoundingBox createMaxMinBBox()
public static final boolean isMaxMinBBox(BoundingBox bbox)
public static final BoundingBox createMinMaxBBox()
public static final boolean isMinMaxBBox(BoundingBox bbox)
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||