public final class FloatRect extends Object implements Serializable
Modifier and Type | Field and Description |
---|---|
static FloatRect |
EMPTY
An empty rectangle with no dimensions.
|
float |
height
The height of the rectangle.
|
float |
left
The X coordinate of the rectangle's left edge.
|
float |
top
The Y coordinate of the rectangle's top edge.
|
float |
width
The width of the rectangle.
|
Constructor and Description |
---|
FloatRect(float left,
float top,
float width,
float height)
Constructs a new rectangle with the specified parameters.
|
FloatRect(IntRect rect)
Constructs a new rectangle by converting an intergral rectangle.
|
FloatRect(Vector2f position,
Vector2f size)
Constructs a new rectangle with the specified parameters.
|
Modifier and Type | Method and Description |
---|---|
boolean |
contains(float x,
float y)
Tests whether a point is inside the rectangle's boundaries, including its edges.
|
boolean |
contains(Vector2f point)
Tests whether a point is inside the rectangle's boundaries, including its edges.
|
boolean |
equals(Object o) |
int |
hashCode() |
FloatRect |
intersection(FloatRect rect)
Tests whether this rectangle intersects with another rectangle and
calculates the rectangle of intersection.
|
String |
toString() |
public static final FloatRect EMPTY
public final float left
public final float top
public final float width
public final float height
public FloatRect(float left, float top, float width, float height)
left
- the X coordinate of the rectangle's left edge.top
- the Y coordinate of the rectangle's top edge.width
- the rectangle's width.height
- the rectangle's height.public FloatRect(Vector2f position, Vector2f size)
position
- the position of the rectangle's top left corner.size
- the rectangle's dimension.public FloatRect(IntRect rect)
rect
- the rectangle to convert.public boolean contains(float x, float y)
x
- the X coordinate of the tested point.y
- the Y coordinate of the tested point.true
if the point lies within the rectangle's boundaries,
false
otherwise.public boolean contains(Vector2f point)
point
- the point to be tested.true
if the point lies within the rectangle's boundaries,
false
otherwise.public FloatRect intersection(FloatRect rect)
rect
- the rectangle to test against.null
if the rectangles do not intersect.