Class Bounds2i
java.lang.Object
com.thecsdev.common.math.Bounds2i
- All Implemented Interfaces:
Cloneable
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal Bounds2iadd(int x, int y, int width, int height) Returns a newBounds2iinstance with the arguments added to it.final Bounds2iclone()final booleancontains(int x, int y) Returnstrueif this rectangle contains a 2D point.final booleanReturnstrueif this rectangle completely contains anotherBounds2i.final booleanfinal inthashCode()final booleanhasSamePosition(@NotNull Bounds2i other) final booleanhasSameSize(@NotNull Bounds2i other) final Bounds2iheight(int height) Returns a newBounds2iinstance with the given height while retaining the current X, Y and width.final booleanintersects(@NotNull Bounds2i other) Returnstrueif this rectangle intersects with anotherBounds2i.final Bounds2iposition(int x, int y) Returns a newBounds2iinstance with the given X and Y position while retaining the current width and height.final Bounds2isize(int width, int height) Returns a newBounds2iinstance with the given width and height while retaining the current X and Y position.final Bounds2isub(int x, int y, int width, int height) Returns a newBounds2iinstance with the arguments subtracted from it.final StringtoString()final Bounds2iwidth(int width) Returns a newBounds2iinstance with the given width while retaining the current X, Y and height.final Bounds2ix(int x) Returns a newBounds2iinstance with the given X position while retaining the current Y, width and height.final Bounds2iy(int y) Returns a newBounds2iinstance with the given Y position while retaining the current X, width and height.
-
Field Details
-
ZERO
The default "zero" value whose (x, y, width, height) values are all0. -
x
public final int x -
y
public final int y -
width
public final int width -
height
public final int height -
endX
public final int endX -
endY
public final int endY -
isEmpty
-
-
Constructor Details
-
Bounds2i
public Bounds2i(int x, int y, int width, int height)
-
-
Method Details
-
hashCode
-
equals
-
clone
-
toString
-
contains
public final boolean contains(int x, int y) Returnstrueif this rectangle contains a 2D point.- Parameters:
x- The point's X position.y- The point's Y position.
-
contains
Returnstrueif this rectangle completely contains anotherBounds2i.- Parameters:
other- The otherBounds2ito compare to.- Throws:
NullPointerException- If the argument isnull.- API Note:
- This function is mathematically asymmetric.
-
intersects
Returnstrueif this rectangle intersects with anotherBounds2i.- Parameters:
other- The otherBounds2ito compare to.- Throws:
NullPointerException- If the argument isnull.- API Note:
- This function is mathematically symmetric.
-
hasSamePosition
-
hasSameSize
-
add
-
sub
-
position
-
x
-
y
-
size
-
width
-
height
-