Constructor and Description |
---|
Rectangle(float x,
float y,
float x2,
float y2)
Creates a new
Rectangle with the given coordinates. |
Rectangle(Region src) |
Modifier and Type | Method and Description |
---|---|
float |
area()
The total area of this region.
|
Region |
bounds()
Instances of
Region will always return themselves from their bounds implementations. |
float |
by()
The bottom edge of this region.
|
static boolean |
contains(Region query,
Region r)
Returns true only if
r is entirely contained within query . |
float |
endxpos() |
float |
endypos() |
float |
height()
The total height of this region.
|
static Rectangle |
intersection(Region... regions)
Returns a Rectangle that is the
intersection of
start and all of the remaining provided Regions,
or null if there is no common intersection. |
static boolean |
intersects(Region r1,
Region r2)
Returns true only if any portion of the two Regions intersect.
|
float |
lx()
The left edge of this region.
|
float |
rx()
The right edge of this region.
|
java.lang.String |
toString() |
float |
ty()
The top edge of this region.
|
static Rectangle |
union(Region... regions)
Returns a
Rectangle whose coordinates represent the minimum bounding rectangle of all of the
provided rectangles. |
float |
width()
The width of this region.
|
float |
xpos() |
float |
ypos() |
public Rectangle(float x, float y, float x2, float y2)
Rectangle
with the given coordinates. Note that the coordinates are assigned such that
lx <= rx
and by <= ty
. So, e.g. x2
could be assigned to Rectangle.rx()
or
Rectangle.lx()
.public Rectangle(Region src)
public final float width()
Region
public final float height()
Region
public final float area()
Region
public java.lang.String toString()
toString
in class java.lang.Object
public Region bounds()
Region
Region
will always return themselves from their bounds
implementations.public float lx()
Region
public float rx()
Region
public float by()
Region
public float ty()
Region
public static boolean intersects(Region r1, Region r2)
public static boolean contains(Region query, Region r)
r
is entirely contained within query
.public static final Rectangle union(Region... regions)
Rectangle
whose coordinates represent the minimum bounding rectangle of all of the
provided rectangles.java.lang.IllegalArgumentException
- if no regions are provided