public class Rectangle
extends java.lang.Object
implements java.io.Serializable
| Modifier and Type | Field and Description |
|---|---|
float |
height |
static Rectangle |
tmp
Static temporary rectangle.
|
static Rectangle |
tmp2
Static temporary rectangle.
|
float |
width |
float |
x |
float |
y |
| Constructor and Description |
|---|
Rectangle()
Constructs a new rectangle with all values set to zero
|
Rectangle(float x,
float y,
float width,
float height)
Constructs a new rectangle with the given corner point in the bottom left and dimensions.
|
Rectangle(Rectangle rect)
Constructs a rectangle based on the given rectangle
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
contains(float x,
float y) |
boolean |
contains(Rectangle rectangle) |
float |
getHeight() |
float |
getWidth() |
float |
getX() |
float |
getY() |
void |
merge(Rectangle rect)
Merges this rectangle with the other rectangle.
|
boolean |
overlaps(Rectangle rectangle) |
void |
set(float x,
float y,
float width,
float height) |
void |
set(Rectangle rect)
Sets the values of the given rectangle to this rectangle.
|
void |
setHeight(float height)
Sets the height of this rectangle
|
void |
setWidth(float width)
Sets the width of this rectangle
|
void |
setX(float x)
Sets the x-coordinate of the bottom left corner
|
void |
setY(float y)
Sets the y-coordinate of the bottom left corner
|
java.lang.String |
toString() |
public static final Rectangle tmp
public static final Rectangle tmp2
public float x
public float y
public float width
public float height
public Rectangle()
public Rectangle(float x,
float y,
float width,
float height)
x - The corner point x-coordinatey - The corner point y-coordinatewidth - The widthheight - The heightpublic Rectangle(Rectangle rect)
rect - The rectanglepublic float getX()
public void setX(float x)
x - The x-coordinatepublic float getY()
public void setY(float y)
y - The y-coordinatepublic float getWidth()
public void setWidth(float width)
width - The widthpublic float getHeight()
public void setHeight(float height)
height - The heightpublic boolean contains(Rectangle rectangle)
rectangle - the other Rectangle.public boolean overlaps(Rectangle rectangle)
rectangle - the other Rectanglepublic void set(float x,
float y,
float width,
float height)
public boolean contains(float x,
float y)
x - point x coordinatey - point y coordinatepublic void set(Rectangle rect)
rect - the other rectanglepublic void merge(Rectangle rect)
rect - the other rectanglepublic java.lang.String toString()
toString in class java.lang.Object