public final class RectI
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static RectI |
EMPTY
An empty read-only
RectI. |
PointI |
max
The greatest coordinates within the
RectI. |
PointI |
min
The smallest coordinates within the
RectI. |
| Constructor and Description |
|---|
RectI()
Creates a
RectI with all coordinates set to zero. |
RectI(int minX,
int minY,
int maxX,
int maxY)
Creates a
RectI with the specified Integer coordinates. |
RectI(PointI min,
PointI max)
|
| Modifier and Type | Method and Description |
|---|---|
static RectI |
circumscribe(PointI... points)
|
boolean |
contains(int x,
int y)
Determines whether the
RectI contains the specified Integer coordinates. |
boolean |
contains(PointI point)
|
boolean |
contains(RectI rect)
Determines whether the
RectI entirely contains the specified instance. |
boolean |
containsOpen(int x,
int y)
|
boolean |
containsOpen(PointI point)
|
PointI |
distanceVector(PointI q)
|
boolean |
equals(java.lang.Object obj)
Compares the specified
Object to this RectI instance. |
static RectI[] |
fromInts(int... rects)
Converts the specified
Integer array to a RectI array. |
int |
hashCode()
Returns a hash code for the
RectI. |
long |
height()
Gets the height the
RectI. |
RectI |
intersect(RectI rect)
Finds the intersection of the
RectI with the specified instance. |
boolean |
intersectsWith(RectI rect)
Determines whether the
RectI intersects with the specified instance. |
RectLocation |
locate(PointI q)
|
RectI |
offset(int x,
int y)
Offsets the
RectI by the specified Integer distances. |
RectI |
offset(PointI vector)
|
static int[] |
toInts(RectI... rects)
Converts the specified
RectI array to an Integer array. |
RectD |
toRectD()
|
java.lang.String |
toString()
Returns a
String representation of the RectI. |
RectI |
union(RectI rect)
Finds the union of the
RectI with the specified instance. |
long |
width()
Gets the width the
RectI. |
public final PointI min
public final PointI max
public static final RectI EMPTY
public RectI()
public RectI(int minX,
int minY,
int maxX,
int maxY)
RectI with the specified Integer coordinates.minX - the smallest x-coordinate within the RectIminY - the smallest y-coordinate within the RectImaxX - the greatest x-coordinate within the RectImaxY - the greatest y-coordinate within the RectIjava.lang.IllegalArgumentException - if maxX is less than minX,
or maxY is less than minYpublic boolean contains(int x,
int y)
RectI contains the specified Integer coordinates.public boolean contains(PointI point)
public boolean contains(RectI rect)
RectI entirely contains the specified instance.public boolean containsOpen(int x,
int y)
public boolean containsOpen(PointI point)
public PointI distanceVector(PointI q)
PointI coordinates
to the nearest edges of the RectI.
The returned coordinates are negative if the corresponding dimension of q
if less than that of min, and positive if it is greater than max.q - the PointI to examinePointI whose dimensions equal zero if they fall within
the corresponding dimensions of min and max,
else the signed difference to the nearest edge coordinatejava.lang.ArithmeticException - if the difference in any dimension overflows Integerjava.lang.NullPointerException - if q is nullpublic static RectI[] fromInts(int... rects)
Integer array to a RectI array.
The returned array has a quarter as many elements as the specified
rects and retains the same coordinate sequence.rects - an array containing the coordinates min.x, min.y, max.x, max.y of
RectI instances, stored in successive index positions per RectIRectI array created from rectsjava.lang.IllegalArgumentException - if the length of rects is not divisible by four,
or if any max coordinate is less than the corresponding min coordinatejava.lang.NullPointerException - if rects is nullpublic long height()
public RectI intersect(RectI rect)
RectI with the specified instance.public boolean intersectsWith(RectI rect)
RectI intersects with the specified instance.rect - the RectI to examinetrue if rect shares any coordinates with this instance,
else falsejava.lang.NullPointerException - if rect is nullpublic RectLocation locate(PointI q)
q - the PointI coordinates to examineRectLocation indicating the location of q
relative to the RectD in each dimensionjava.lang.NullPointerException - if q is nullpublic RectI offset(int x, int y)
RectI by the specified Integer distances.x - the horizontal offset applied to the RectIy - the vertical offset applied to the RectIRectI whose min and max equal those of the current
instance, with x and y added to all corresponding dimensionsjava.lang.ArithmeticException - if the new coordinates in any dimension overflow Integerpublic RectI offset(PointI vector)
vector - the PointI offset applied to the RectIRectI whose min and max equal those
of the current instance, with vector added to both pointsjava.lang.ArithmeticException - if the new coordinates in any dimension overflow Integerjava.lang.NullPointerException - if vector is nullpublic static int[] toInts(RectI... rects)
RectI array to an Integer array.
The returned array has four times as many elements as the specified
rects and retains the same coordinate sequence.public RectD toRectD()
public long width()
public boolean equals(java.lang.Object obj)
Object to this RectI instance.public int hashCode()
RectI.hashCode in class java.lang.ObjectInteger hash code for the RectI