public class Rectangled extends Object implements Externalizable
| Modifier and Type | Field and Description |
|---|---|
double |
maxX
The x coordinate of the maximum corner.
|
double |
maxY
The y coordinate of the maximum corner.
|
double |
minX
The x coordinate of the minimum corner.
|
double |
minY
The y coordinate of the minimum corner.
|
| Constructor and Description |
|---|
Rectangled()
Create a new
Rectangled with a minimum and maximum corner of (0, 0). |
Rectangled(double minX,
double minY,
double maxX,
double maxY)
Create a new
Rectangled with the given minimum and maximum corner coordinates. |
Rectangled(Rectangled source)
Create a new
Rectangled as a copy of the given source. |
Rectangled(Vector2dc min,
Vector2dc max)
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
contains(double x,
double y)
Check if this rectangle contains the given point
(x, y). |
boolean |
contains(Vector2d 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. |
Rectangled |
translate(double x,
double y)
Translate
this by the vector (x, y). |
Rectangled |
translate(double x,
double y,
Rectangled dest)
Translate
this by the vector (x, y) and store the result in dest. |
Rectangled |
translate(Vector2dc xy)
Translate
this by the given vector xy. |
Rectangled |
translate(Vector2dc xy,
Rectangled dest)
Translate
this by the given vector xy and store the result in dest. |
Rectangled |
translate(Vector2fc xy)
Translate
this by the given vector xy. |
Rectangled |
translate(Vector2fc xy,
Rectangled dest)
Translate
this by the given vector xy and store the result in dest. |
void |
writeExternal(ObjectOutput out) |
public double minX
public double minY
public double maxX
public double maxY
public Rectangled()
Rectangled with a minimum and maximum corner of (0, 0).public Rectangled(Rectangled source)
Rectangled as a copy of the given source.source - the Rectangled to copy frompublic Rectangled(Vector2dc min, Vector2dc max)
min - the minimum coordinatesmax - the maximum coordinatespublic Rectangled(double minX,
double minY,
double maxX,
double maxY)
Rectangled 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(Vector2d point)
point.point - the point to testtrue iff this rectangle contains the point; false otherwisepublic boolean contains(double x,
double 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 Rectangled translate(Vector2dc xy)
this by the given vector xy.xy - the vector to translate bypublic Rectangled translate(Vector2dc xy, Rectangled dest)
this by the given vector xy and store the result in dest.xy - the vector to translate bydest - will hold the resultpublic Rectangled translate(Vector2fc xy)
this by the given vector xy.xy - the vector to translate bypublic Rectangled translate(Vector2fc xy, Rectangled dest)
this by the given vector xy and store the result in dest.xy - the vector to translate bydest - will hold the resultpublic Rectangled translate(double x, double y)
this by the vector (x, y).x - the x coordinate to translate byy - the y coordinate to translate bypublic Rectangled translate(double x, double y, Rectangled 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.