public class Rectanglei extends Object implements Externalizable
| Modifier and Type | Field and Description |
|---|---|
int |
maxX
The x coordinate of the maximum corner.
|
int |
maxY
The y coordinate of the maximum corner.
|
int |
minX
The x coordinate of the minimum corner.
|
int |
minY
The y coordinate of the minimum corner.
|
| Constructor and Description |
|---|
Rectanglei()
Create a new
Rectanglei with a minimum and maximum corner of (0, 0). |
Rectanglei(int minX,
int minY,
int maxX,
int maxY)
Create a new
Rectanglei with the given minimum and maximum corner coordinates. |
Rectanglei(Rectanglei source)
Create a new
Rectanglei as a copy of the given source. |
Rectanglei(org.joml.Vector2ic min,
org.joml.Vector2ic max)
|
| Modifier and Type | Method and Description |
|---|---|
int |
area()
Return the area of the rectangle
|
boolean |
containsPoint(float x,
float y)
Test whether the point
(x, y) lies inside this BlockRegion. |
boolean |
containsPoint(int x,
int y)
Check if this rectangle contains the given point
(x, y). |
boolean |
containsPoint(org.joml.Vector2fc point)
Test whether the point
(x, y) lies inside this BlockRegion. |
boolean |
containsPoint(org.joml.Vector2ic 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() |
Rectanglei |
intersection(Rectanglei other)
Compute the rectangle of intersection between
this and the given rectangle. |
Rectanglei |
intersection(Rectanglei other,
Rectanglei 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.Vector2i |
lengths(org.joml.Vector2i dest)
Return the length of this rectangle in the X and Y dimensions and store the result in
dest. |
int |
lengthX()
Return the length of the rectangle in the X dimension.
|
int |
lengthY()
Return the length of the rectangle in the Y dimension.
|
void |
readExternal(ObjectInput in) |
Rectanglei |
scale(int sf)
Scale
this about the origin. |
Rectanglei |
scale(int sx,
int sy)
Scale
this about the origin. |
Rectanglei |
scale(int sf,
int ax,
int ay)
Scale
this about an anchor. |
Rectanglei |
scale(int sx,
int sy,
int ax,
int ay)
Scale
this about an anchor. |
Rectanglei |
scale(int sx,
int sy,
int ax,
int ay,
Rectanglei dest)
Scale
this about an anchor and store the result in dest. |
Rectanglei |
scale(int sf,
int ax,
int ay,
Rectanglei dest)
Scale
this about an anchor and store the result in dest. |
Rectanglei |
scale(int sx,
int sy,
Rectanglei dest)
Scale
this about the origin and store the result in dest. |
Rectanglei |
scale(int sx,
int sy,
org.joml.Vector2ic anchor)
Scale
this about an anchor. |
Rectanglei |
scale(int sx,
int sy,
org.joml.Vector2ic anchor,
Rectanglei dest)
Scale
this about an anchor and store the result in dest. |
Rectanglei |
scale(int sf,
Rectanglei dest)
Scale
this about the origin and store the result in dest. |
Rectanglei |
scale(int sf,
org.joml.Vector2ic anchor)
Scale
this about an anchor. |
Rectanglei |
scale(int sf,
org.joml.Vector2ic anchor,
Rectanglei dest)
Scale
this about an anchor and store the result in dest. |
Rectanglei |
set(Rectanglei source)
Set this
Rectanglei to be a clone of source. |
Rectanglei |
setMax(int maxX,
int maxY)
Set the maximum corner coordinates.
|
Rectanglei |
setMax(org.joml.Vector2ic max)
Set the maximum corner coordinates.
|
Rectanglei |
setMin(int minX,
int minY)
Set the minimum corner coordinates.
|
Rectanglei |
setMin(org.joml.Vector2ic 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. |
Rectanglei |
translate(int x,
int y)
Translate
this by the vector (x, y). |
Rectanglei |
translate(int x,
int y,
Rectanglei dest)
Translate
this by the vector (x, y) and store the result in dest. |
Rectanglei |
translate(org.joml.Vector2ic xy)
Translate
this by the given vector xy. |
Rectanglei |
translate(org.joml.Vector2ic xy,
Rectanglei dest)
Translate
this by the given vector xy and store the result in dest. |
Rectanglei |
union(int x,
int y)
Set
this to the union of this and the given point p. |
Rectanglei |
union(int x,
int y,
Rectanglei dest)
Compute the union of
this and the given point (x, y, z) and store the result in dest. |
Rectanglei |
union(Rectanglei other)
Set
this to the union of this and other. |
Rectanglei |
union(Rectanglei other,
Rectanglei dest)
Compute the union of
this and other and store the result in dest. |
Rectanglei |
union(org.joml.Vector2ic p)
Set
this to the union of this and the given point p. |
Rectanglei |
union(org.joml.Vector2ic p,
Rectanglei dest)
Compute the union of
this and the given point p and store the result in dest. |
void |
writeExternal(ObjectOutput out) |
public int minX
public int minY
public int maxX
public int maxY
public Rectanglei()
Rectanglei with a minimum and maximum corner of (0, 0).public Rectanglei(Rectanglei source)
Rectanglei as a copy of the given source.source - the Rectanglei to copy frompublic Rectanglei(org.joml.Vector2ic min,
org.joml.Vector2ic max)
min - the minimum coordinatesmax - the maximum coordinatespublic Rectanglei(int minX,
int minY,
int maxX,
int maxY)
Rectanglei 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 Rectanglei set(Rectanglei source)
Rectanglei to be a clone of source.source - the Rectanglei to copy frompublic Rectanglei setMin(int minX, int minY)
minX - the x coordinate of the minimum cornerminY - the y coordinate of the minimum cornerpublic Rectanglei setMin(org.joml.Vector2ic min)
min - the minimum coordinatespublic Rectanglei setMax(int maxX, int maxY)
maxX - the x coordinate of the maximum cornermaxY - the y coordinate of the maximum cornerpublic Rectanglei setMax(org.joml.Vector2ic max)
max - the maximum coordinatespublic int lengthX()
public int lengthY()
public int area()
public Rectanglei union(int x, int 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 Rectanglei union(org.joml.Vector2ic p)
this to the union of this and the given point p.p - the pointpublic Rectanglei union(int x, int y, Rectanglei 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 Rectanglei union(org.joml.Vector2ic p, Rectanglei dest)
this and the given point p and store the result in dest.p - the pointdest - will hold the resultpublic Rectanglei union(Rectanglei other)
this to the union of this and other.other - the other Rectangleipublic Rectanglei union(Rectanglei other, Rectanglei dest)
this and other and store the result in dest.other - the other Rectangleidest - 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 Rectanglei intersection(Rectanglei other)
this and the given rectangle.
If the two rectangles do not intersect, then the minimum coordinates of this
will have a value of Integer.MAX_VALUE and the maximum coordinates will have a value of
Integer.MIN_VALUE.
other - the other rectanglepublic Rectanglei intersection(Rectanglei other, Rectanglei dest)
this and the given rectangle and
store the result in dest.
If the two rectangles do not intersect, then the minimum coordinates of dest
will have a value of Integer.MAX_VALUE and the maximum coordinates will have a value of
Integer.MIN_VALUE.
other - the other rectangledest - will hold the resultpublic org.joml.Vector2i lengths(org.joml.Vector2i 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.Vector2ic point)
point.point - the point to testtrue iff this rectangle contains the point; false otherwisepublic boolean containsPoint(float x,
float y)
(x, y) lies inside this BlockRegion.x - the x coordinate of the pointy - the y coordinate of the pointtrue iff the given point lies inside this BlockRegion; false otherwisepublic boolean containsPoint(org.joml.Vector2fc point)
(x, y) lies inside this BlockRegion.point - the point to testtrue iff the given point lies inside this BlockRegion; false otherwisepublic boolean containsPoint(int x,
int 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 Rectanglei translate(org.joml.Vector2ic xy)
this by the given vector xy.xy - the vector to translate bypublic Rectanglei translate(org.joml.Vector2ic xy, Rectanglei dest)
this by the given vector xy and store the result in dest.xy - the vector to translate bydest - will hold the resultpublic Rectanglei translate(int x, int y)
this by the vector (x, y).x - the x coordinate to translate byy - the y coordinate to translate bypublic Rectanglei translate(int x, int y, Rectanglei 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 Rectanglei scale(int sf)
this about the origin.sf - the scaling factor in the x and y axis.public Rectanglei scale(int sf, Rectanglei 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 Rectanglei scale(int sf, int ax, int ay)
this about an anchor.
This is effectively 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 Rectanglei scale(int sf, int ax, int ay, Rectanglei dest)
this about an anchor and store the result in dest.
This is effectively 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 anchordest - will hold the resultpublic Rectanglei scale(int sf, org.joml.Vector2ic anchor)
this about an anchor.
This is effectively 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 Rectanglei scale(int sf, org.joml.Vector2ic anchor, Rectanglei dest)
this about an anchor and store the result in dest.
This is effectively equivalent to
translate(anchor.negate());
scale(sf);
translate(anchor.negate());
sf - the scaling factor in the x and y axisanchor - the location of the anchordest - will hold the resultpublic Rectanglei scale(int sx, int sy)
this about the origin.sx - the scaling factor on the x axissy - the scaling factor on the y axispublic Rectanglei scale(int sx, int sy, Rectanglei 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 Rectanglei scale(int sx, int sy, int ax, int 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 Rectanglei scale(int sx, int sy, org.joml.Vector2ic 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 Rectanglei scale(int sx, int sy, int ax, int ay, Rectanglei dest)
this about an anchor and store the result in dest.
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 anchordest - will hold the resultpublic Rectanglei scale(int sx, int sy, org.joml.Vector2ic anchor, Rectanglei dest)
this about an anchor and store the result in dest.
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 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.