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(org.joml.Vector2fc min,
org.joml.Vector2fc max)
|
| Modifier and Type | Method and Description |
|---|---|
float |
area()
Return the area of the rectangle
|
boolean |
containsPoint(float x,
float y)
Check if this rectangle contains the given point
(x, y). |
boolean |
containsPoint(org.joml.Vector2fc 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() |
Rectanglef |
intersection(Rectanglef other)
Compute the rectangle of intersection between
this and the given rectangle. |
Rectanglef |
intersection(Rectanglef other,
Rectanglef dest)
Compute the rectangle of intersection between
this and the given rectangle and
store the result in dest. |
Rectanglef |
intersection(Rectanglei other)
Compute the rectangle of intersection between
this and the given rectangle. |
Rectanglef |
intersection(Rectanglei other,
Rectanglef 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.Vector2f |
lengths(org.joml.Vector2f dest)
Return the length of this rectangle in the X and Y dimensions and store the result in
dest. |
float |
lengthX()
Return the length of the rectangle in the X dimension.
|
float |
lengthY()
Return the length of the rectangle in the Y dimension.
|
void |
readExternal(ObjectInput in) |
Rectanglef |
scale(float sf)
Scale
this about the origin. |
Rectanglef |
scale(float sx,
float sy)
Scale
this about the origin. |
Rectanglef |
scale(float sf,
float ax,
float ay)
Scale
this about an anchor. |
Rectanglef |
scale(float sx,
float sy,
float ax,
float ay)
Scale
this about an anchor. |
Rectanglef |
scale(float sx,
float sy,
float ax,
float ay,
Rectanglef dest)
Scale
this about an anchor and store the result in dest. |
Rectanglef |
scale(float sf,
float ax,
float ay,
Rectanglef dest)
Scale
this about an anchor and store the result in dest. |
Rectanglef |
scale(float sx,
float sy,
Rectanglef dest)
Scale
this about the origin and store the result in dest. |
Rectanglef |
scale(float sx,
float sy,
org.joml.Vector2fc anchor)
Scale
this about an anchor. |
Rectanglef |
scale(float sx,
float sy,
org.joml.Vector2fc anchor,
Rectanglef dest)
Scale
this about an anchor and store the result in dest. |
Rectanglef |
scale(float sf,
Rectanglef dest)
Scale
this about the origin and store the result in dest. |
Rectanglef |
scale(float sf,
org.joml.Vector2fc anchor)
Scale
this about an anchor. |
Rectanglef |
scale(float sf,
org.joml.Vector2fc anchor,
Rectanglef dest)
Scale
this about an anchor and store the result in dest. |
Rectanglef |
set(Rectanglef source)
Set this
Rectanglei to be a clone of source. |
Rectanglef |
setMax(float maxX,
float maxY)
Set the maximum corner coordinates.
|
Rectanglef |
setMax(org.joml.Vector2fc max)
Set the maximum corner coordinates.
|
Rectanglef |
setMin(float minX,
float minY)
Set the minimum corner coordinates.
|
Rectanglef |
setMin(org.joml.Vector2fc 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. |
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(org.joml.Vector2fc xy)
Translate
this by the given vector xy. |
Rectanglef |
translate(org.joml.Vector2fc xy,
Rectanglef dest)
Translate
this by the given vector xy and store the result in dest. |
Rectanglef |
union(float x,
float y)
Set
this to the union of this and the given point p. |
Rectanglef |
union(float x,
float y,
Rectanglef dest)
Compute the union of
this and the given point (x, y, z) and store the result in dest. |
Rectanglef |
union(Rectanglef other)
Set
this to the union of this and other. |
Rectanglef |
union(Rectanglef other,
Rectanglef dest)
Compute the union of
this and other and store the result in dest. |
Rectanglef |
union(org.joml.Vector2fc p)
Set
this to the union of this and the given point p. |
Rectanglef |
union(org.joml.Vector2ic p,
Rectanglef dest)
Compute the union of
this and the given point p 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(org.joml.Vector2fc min,
org.joml.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 Rectanglef set(Rectanglef source)
Rectanglei to be a clone of source.source - the Rectanglei to copy frompublic Rectanglef setMin(float minX, float minY)
minX - the x coordinate of the minimum cornerminY - the y coordinate of the minimum cornerpublic Rectanglef setMin(org.joml.Vector2fc min)
min - the minimum coordinatespublic Rectanglef setMax(float maxX, float maxY)
maxX - the x coordinate of the maximum cornermaxY - the y coordinate of the maximum cornerpublic Rectanglef setMax(org.joml.Vector2fc max)
max - the maximum coordinatespublic float lengthX()
public float lengthY()
public float area()
public Rectanglef union(float x, float 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 Rectanglef union(org.joml.Vector2fc p)
this to the union of this and the given point p.p - the pointpublic Rectanglef union(float x, float y, Rectanglef 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 Rectanglef union(org.joml.Vector2ic p, Rectanglef dest)
this and the given point p and store the result in dest.p - the pointdest - will hold the resultpublic Rectanglef union(Rectanglef other)
this to the union of this and other.other - the other Rectanglefpublic Rectanglef union(Rectanglef other, Rectanglef dest)
this and other and store the result in dest.other - the other Rectanglefdest - 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 isValid()
this rectangle represents a valid rectangle.true iff this rectangle is valid; false otherwisepublic Rectanglef intersection(Rectanglef other)
this and the given rectangle.
If the two rectangles do not intersect, then Float.NaN is stored in each component
of dest.
other - the other rectanglepublic Rectanglef intersection(Rectanglei other)
this and the given rectangle.
If the two rectangles do not intersect, then Float.NaN is stored in each component
of dest.
other - the other rectanglepublic Rectanglef intersection(Rectanglef other, Rectanglef dest)
this and the given rectangle and
store the result in dest.
If the two rectangles do not intersect, then Float.NaN is stored in each component
of dest.
other - the other rectangledest - will hold the resultpublic Rectanglef intersection(Rectanglei other, Rectanglef 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.Vector2f lengths(org.joml.Vector2f 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 boolean containsPoint(org.joml.Vector2fc point)
point.point - the point to testtrue iff this rectangle contains the point; false otherwisepublic boolean containsPoint(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(org.joml.Vector2fc xy)
this by the given vector xy.xy - the vector to translate bypublic Rectanglef translate(org.joml.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 Rectanglef scale(float sf)
this about the origin.sf - the scaling factor in the x and y axispublic Rectanglef scale(float sf, Rectanglef 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 Rectanglef scale(float sf, float ax, float 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 Rectanglef scale(float sf, float ax, float ay, Rectanglef 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 Rectanglef scale(float sf, org.joml.Vector2fc 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 Rectanglef scale(float sf, org.joml.Vector2fc anchor, Rectanglef 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 Rectanglef scale(float sx, float sy)
this about the origin.sx - the scaling factor on the x axissy - the scaling factor on the y axispublic Rectanglef scale(float sx, float sy, Rectanglef 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 Rectanglef scale(float sx, float sy, float ax, float 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 Rectanglef scale(float sx, float sy, org.joml.Vector2fc 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 Rectanglef scale(float sx, float sy, float ax, float ay, Rectanglef 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 Rectanglef scale(float sx, float sy, org.joml.Vector2fc anchor, Rectanglef 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.