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(org.joml.Vector2dc min,
org.joml.Vector2dc max)
|
| Modifier and Type | Method and Description |
|---|---|
double |
area()
Return the area of the rectangle
|
boolean |
containsPoint(double x,
double y)
Check if this rectangle contains the given point
(x, y). |
boolean |
containsPoint(org.joml.Vector2dc point)
Check if this rectangle contains the given
point. |
boolean |
containsRectangle(Rectangled rectangle)
Check if this rectangle contains the given
rectangle. |
boolean |
containsRectangle(Rectanglef rectangle)
Check if this rectangle contains the given
rectangle. |
boolean |
containsRectangle(Rectanglei rectangle)
Check if this rectangle contains the given
rectangle. |
boolean |
equals(Object obj) |
int |
hashCode() |
Rectangled |
intersection(Rectangled other)
Compute the rectangle of intersection between
this and the given rectangle. |
Rectangled |
intersection(Rectangled other,
Rectangled dest)
Compute the rectangle of intersection between
this and the given rectangle and
store the result in dest. |
Rectangled |
intersection(Rectanglef other,
Rectangled dest)
Compute the rectangle of intersection between
this and the given rectangle and
store the result in dest. |
Rectangled |
intersection(Rectanglei other,
Rectangled dest)
Compute the rectangle of intersection between
this and the given rectangle and
store the result in dest. |
boolean |
intersectsRectangle(Rectangled other)
Check if this and the given rectangle intersect.
|
boolean |
intersectsRectangle(Rectanglef other)
Check if this and the given rectangle intersect.
|
boolean |
intersectsRectangle(Rectanglei other)
Check if this and the given rectangle intersect.
|
boolean |
isValid()
Check whether
this rectangle represents a valid rectangle. |
org.joml.Vector2d |
lengths(org.joml.Vector2d dest)
Return the length of this rectangle in the X and Y dimensions and store the result in
dest. |
double |
lengthX()
Return the length of the rectangle in the X dimension.
|
double |
lengthY()
Return the length of the rectangle in the Y dimension.
|
void |
readExternal(ObjectInput in) |
Rectangled |
scale(double sf)
Scale
this about the origin. |
Rectangled |
scale(double sx,
double sy)
Scale
this about the origin. |
Rectangled |
scale(double sf,
double ax,
double ay)
Scale
this about an anchor. |
Rectangled |
scale(double sx,
double sy,
double ax,
double ay)
Scale
this about an anchor. |
Rectangled |
scale(double sx,
double sy,
double ax,
double ay,
Rectangled dest)
Scale
this about an anchor and store the result in dest. |
Rectangled |
scale(double sf,
double ax,
double ay,
Rectangled dest)
Scale
this about an anchor and store the result in dest. |
Rectangled |
scale(double sx,
double sy,
Rectangled dest)
Scale
this about the origin and store the result in dest. |
Rectangled |
scale(double sx,
double sy,
org.joml.Vector2dc anchor)
Scale
this about an anchor. |
Rectangled |
scale(double sx,
double sy,
org.joml.Vector2dc anchor,
Rectangled dest)
Scale
this about an anchor and store the result in dest. |
Rectangled |
scale(double sf,
Rectangled dest)
Scale
this about the origin and store the result in dest. |
Rectangled |
scale(double sf,
org.joml.Vector2dc anchor)
Scale
this about an anchor. |
Rectangled |
scale(double sf,
org.joml.Vector2dc anchor,
Rectangled dest)
Scale
this about an anchor and store the result in dest. |
Rectangled |
set(Rectangled source)
Set this
Rectangled to be a clone of source. |
Rectangled |
setMax(double maxX,
double maxY)
Set the maximum corner coordinates.
|
Rectangled |
setMax(org.joml.Vector2dc max)
Set the maximum corner coordinates.
|
Rectangled |
setMin(double minX,
double minY)
Set the minimum corner coordinates.
|
Rectangled |
setMin(org.joml.Vector2dc min)
Set the minimum corner coordinates.
|
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(org.joml.Vector2dc xy)
Translate
this by the given vector xy. |
Rectangled |
translate(org.joml.Vector2dc xy,
Rectangled dest)
Translate
this by the given vector xy and store the result in dest. |
Rectangled |
translate(org.joml.Vector2fc xy)
Translate
this by the given vector xy. |
Rectangled |
translate(org.joml.Vector2fc xy,
Rectangled dest)
Translate
this by the given vector xy and store the result in dest. |
Rectangled |
union(double x,
double y)
Set
this to the union of this and the given point p. |
Rectangled |
union(double x,
double y,
Rectangled dest)
Compute the union of
this and the given point (x, y, z) and store the result in dest. |
Rectangled |
union(Rectangled other)
Set
this to the union of this and other. |
Rectangled |
union(Rectangled other,
Rectangled dest)
Compute the union of
this and other and store the result in dest. |
Rectangled |
union(org.joml.Vector2dc p)
Set
this to the union of this and the given point p. |
Rectangled |
union(org.joml.Vector2dc p,
Rectangled dest)
Compute the union of
this and the given point p 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(org.joml.Vector2dc min,
org.joml.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 Rectangled set(Rectangled source)
Rectangled to be a clone of source.source - the Rectangled to copy frompublic Rectangled setMin(double minX, double minY)
minX - the x coordinate of the minimum cornerminY - the y coordinate of the minimum cornerpublic Rectangled setMin(org.joml.Vector2dc min)
min - the minimum coordinatespublic Rectangled setMax(double maxX, double maxY)
maxX - the x coordinate of the maximum cornermaxY - the y coordinate of the maximum cornerpublic Rectangled setMax(org.joml.Vector2dc max)
max - the maximum coordinatespublic double lengthX()
public double lengthY()
public double area()
public boolean isValid()
this rectangle represents a valid rectangle.true iff this rectangle is valid; false otherwisepublic Rectangled intersection(Rectangled other)
this and the given rectangle.
If the two rectangles do not intersect, then Double.NaN is stored in each component
of dest.
other - the other rectanglepublic Rectangled intersection(Rectangled other, Rectangled dest)
this and the given rectangle and
store the result in dest.
If the two rectangles do not intersect, then Double.NaN is stored in each component
of dest.
other - the other rectangledest - will hold the resultpublic Rectangled intersection(Rectanglef other, Rectangled dest)
this and the given rectangle and
store the result in dest.
If the two rectangles do not intersect, then Double.NaN is stored in each component
of dest.
other - the other rectangledest - will hold the resultpublic Rectangled intersection(Rectanglei other, Rectangled dest)
this and the given rectangle and
store the result in dest.
If the two rectangles do not intersect, then Double.NaN is stored in each component
of dest.
other - the other rectangledest - will hold the resultpublic org.joml.Vector2d lengths(org.joml.Vector2d dest)
dest.dest - will hold the resultpublic boolean containsRectangle(Rectangled rectangle)
rectangle.rectangle - the rectangle to testtrue iff this rectangle contains the rectangle; false otherwisepublic boolean containsRectangle(Rectanglef rectangle)
rectangle.rectangle - the rectangle to testtrue iff this rectangle contains the rectangle; false otherwisepublic boolean containsRectangle(Rectanglei rectangle)
rectangle.rectangle - the rectangle to testtrue iff this rectangle contains the rectangle; false otherwisepublic Rectangled union(double x, double y)
this to the union of this and the given point p.x - the x coordinate of the pointy - the y coordinate of the pointpublic Rectangled union(org.joml.Vector2dc p)
this to the union of this and the given point p.p - the pointpublic Rectangled union(double x, double y, Rectangled dest)
this and the given point (x, y, z) and store the result in dest.x - the x coordinate of the pointy - the y coordinate of the pointdest - will hold the resultpublic Rectangled union(org.joml.Vector2dc p, Rectangled dest)
this and the given point p and store the result in dest.p - the pointdest - will hold the resultpublic Rectangled union(Rectangled other)
this to the union of this and other.other - the other Rectanglefpublic Rectangled union(Rectangled other, Rectangled dest)
this and other and store the result in dest.other - the other Rectangleddest - will hold the resultpublic boolean intersectsRectangle(Rectangled other)
other - the other rectangletrue iff both rectangles intersect; false otherwisepublic boolean intersectsRectangle(Rectanglef other)
other - the other rectangletrue iff both rectangles intersect; false otherwisepublic boolean intersectsRectangle(Rectanglei other)
other - the other rectangletrue iff both rectangles intersect; false otherwisepublic boolean containsPoint(org.joml.Vector2dc point)
point.point - the point to testtrue iff this rectangle contains the point; false otherwisepublic boolean containsPoint(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(org.joml.Vector2dc xy)
this by the given vector xy.xy - the vector to translate bypublic Rectangled translate(org.joml.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(org.joml.Vector2fc xy)
this by the given vector xy.xy - the vector to translate bypublic Rectangled translate(org.joml.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 Rectangled scale(double sf)
this about the origin.sf - the scaling factor in the x and y axis.public Rectangled scale(double sf, Rectangled dest)
this about the origin and store the result in dest.sf - the scaling factor in the x and y axisdest - will hold the resultpublic Rectangled scale(double sf, double ax, double ay)
this about an anchor.
This is equivalent to translate(-ax, -ay).scale(sf).translate(ax, ay)
sf - the scaling factor in the x and y axisax - the x coordinate of the anchoray - the y coordinate of the anchorpublic Rectangled scale(double sf, double ax, double ay, Rectangled dest)
this about an anchor and store the result in dest.
This is equivalent to translate(-ax, -ay, dest).scale(sf).translate(ax, ay)
sf - the scaling factor in the x and y axisax - the x coordinate of the anchoray - the y coordinate of the anchordest - will hold the resultpublic Rectangled scale(double sf, org.joml.Vector2dc anchor)
this about an anchor.
This is equivalent to translate(anchor.negate()).scale(sf).translate(anchor.negate())
sf - the scaling factor in the x and y axisanchor - the location of the anchorpublic Rectangled scale(double sf, org.joml.Vector2dc anchor, Rectangled dest)
this about an anchor and store the result in dest.
This is equivalent to translate(anchor.negate(), dest).scale(sf).translate(anchor.negate())
sf - the scaling factor in the x and y axisanchor - the location of the anchordest - will hold the resultpublic Rectangled scale(double sx, double sy)
this about the origin.sx - the scaling factor on the x axissy - the scaling factor on the y axispublic Rectangled scale(double sx, double sy, Rectangled dest)
this about the origin and store the result in dest.sx - the scaling factor on the x axissy - the scaling factor on the y axisdest - will hold the resultpublic Rectangled scale(double sx, double sy, double ax, double ay)
this about an anchor.
This is equivalent to translate(-ax, -ay).scale(sx, sy).translate(ax, ay)
sx - the scaling factor on the x axissy - the scaling factor on the y axisax - the x coordinate of the anchoray - the y coordinate of the anchorpublic Rectangled scale(double sx, double sy, org.joml.Vector2dc anchor)
this about an anchor.
This is equivalent to translate(anchor.negate()).scale(sx, sy).translate(anchor.negate())
sx - the scaling factor on the x axissy - the scaling factor on the y axisanchor - the location of the anchorpublic Rectangled scale(double sx, double sy, double ax, double ay, Rectangled dest)
this about an anchor and store the result in dest.
This is equivalent to translate(-ax, -ay, dest).scale(sx, sy).translate(ax, ay)
sx - the scaling factor on the x axissy - the scaling factor on the y axisax - the x coordinate of the anchoray - the y coordinate of the anchordest - will hold the resultpublic Rectangled scale(double sx, double sy, org.joml.Vector2dc anchor, Rectangled dest)
this about an anchor and store the result in dest.
This is equivalent to translate(anchor.negate(), dest).scale(sx, sy).translate(anchor.negate())
sx - the scaling factor on the x axissy - the scaling factor on the y axisanchor - the location of the anchordest - 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 © 2020 JOML. All rights reserved.