public class Rectanglef extends Object implements Externalizable
| Modifier and Type | Field and Description |
|---|---|
float |
maxX
The x coordinate of the maximum corner.
|
float |
maxY
The y coordinate of the maximum corner.
|
float |
minX
The x coordinate of the minimum corner.
|
float |
minY
The y coordinate of the minimum corner.
|
| Constructor and Description |
|---|
Rectanglef()
Create a new
Rectanglef with a minimum and maximum corner of (0, 0). |
Rectanglef(float minX,
float minY,
float maxX,
float maxY)
Create a new
Rectanglef with the given minimum and maximum corner coordinates. |
Rectanglef(Rectanglef source)
Create a new
Rectanglef as a copy of the given source. |
Rectanglef(Vector2fc min,
Vector2fc max)
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
contains(float x,
float y)
Check if this rectangle contains the given point
(x, y). |
boolean |
contains(Vector2f point)
Check if this rectangle contains the given
point. |
boolean |
equals(Object obj) |
int |
hashCode() |
boolean |
intersects(Rectangled other)
Check if this and the given rectangle intersect.
|
void |
readExternal(ObjectInput in) |
String |
toString()
Return a string representation of this rectangle.
|
String |
toString(NumberFormat formatter)
Return a string representation of this rectangle by formatting the vector components with the given
NumberFormat. |
Rectanglef |
translate(float x,
float y)
Translate
this by the vector (x, y). |
Rectanglef |
translate(float x,
float y,
Rectanglef dest)
Translate
this by the vector (x, y) and store the result in dest. |
Rectanglef |
translate(Vector2fc xy)
Translate
this by the given vector xy. |
Rectanglef |
translate(Vector2fc xy,
Rectanglef dest)
Translate
this by the given vector xy and store the result in dest. |
void |
writeExternal(ObjectOutput out) |
public float minX
public float minY
public float maxX
public float maxY
public Rectanglef()
Rectanglef with a minimum and maximum corner of (0, 0).public Rectanglef(Rectanglef source)
Rectanglef as a copy of the given source.source - the Rectanglef to copy frompublic Rectanglef(Vector2fc min, Vector2fc max)
min - the minimum coordinatesmax - the maximum coordinatespublic Rectanglef(float minX,
float minY,
float maxX,
float maxY)
Rectanglef with the given minimum and maximum corner coordinates.minX - the x coordinate of the minimum cornerminY - the y coordinate of the minimum cornermaxX - the x coordinate of the maximum cornermaxY - the y coordinate of the maximum cornerpublic boolean intersects(Rectangled other)
other - the other rectangletrue iff both rectangles intersect; false otherwisepublic boolean contains(Vector2f point)
point.point - the point to testtrue iff this rectangle contains the point; false otherwisepublic boolean contains(float x,
float y)
(x, y).x - the x coordinate of the point to checky - the y coordinate of the point to checktrue iff this rectangle contains the point; false otherwisepublic Rectanglef translate(Vector2fc xy)
this by the given vector xy.xy - the vector to translate bypublic Rectanglef translate(Vector2fc xy, Rectanglef dest)
this by the given vector xy and store the result in dest.xy - the vector to translate bydest - will hold the resultpublic Rectanglef translate(float x, float y)
this by the vector (x, y).x - the x coordinate to translate byy - the y coordinate to translate bypublic Rectanglef translate(float x, float y, Rectanglef dest)
this by the vector (x, y) and store the result in dest.x - the x coordinate to translate byy - the y coordinate to translate bydest - will hold the resultpublic String toString()
This method creates a new DecimalFormat on every invocation with the format string "0.000E0;-".
public String toString(NumberFormat formatter)
NumberFormat.formatter - the NumberFormat used to format the vector components withpublic void writeExternal(ObjectOutput out) throws IOException
writeExternal in interface ExternalizableIOExceptionpublic void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
readExternal in interface ExternalizableIOExceptionClassNotFoundExceptionCopyright © 2015–2019 JOML. All rights reserved.