public final class Bounds extends Object
| Constructor and Description |
|---|
Bounds(Point[] points)
Creates a Bounds object defined by the points it contains.
|
Bounds(Point topLeft,
Point bottomRight)
Creates a Bounds object from two coordinates.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
contains(Bounds otherBounds)
Returns
true if the rectangle contains the given one. |
boolean |
contains(Point point)
Returns
true if the rectangle contains the given point. |
void |
extend(Point point)
Extends the bounds to contain the given point.
|
Point |
getCenter()
Returns the center point of the bounds.
|
Point |
getMax()
Gets the bottom right corner of the rectangle.
|
Point |
getMin()
Gets the top left corner of the rectangle.
|
Point |
getSize()
Returns the size of the given bounds.
|
boolean |
intersects(Bounds otherBounds)
Returns
true if the rectangle intersects the given bounds. |
boolean |
isValid()
Returns
true if the bounds are properly initialized. |
Bounds |
setMax(Point point)
Sets the bottom right corner of the rectangle.
|
Bounds |
setMin(Point point)
Sets the top left corner of the rectangle.
|
public Bounds(Point topLeft, Point bottomRight)
topLeft - The top left coordinate.bottomRight - The bottom right coordinate.public Bounds(Point[] points)
points - The points defining the bound.public Point getMin()
public Point getMax()
public Bounds setMin(Point point)
point - The top left corner.public Bounds setMax(Point point)
point - The bottom right corner.public void extend(Point point)
point - The point.public Point getCenter()
public boolean contains(Bounds otherBounds)
true if the rectangle contains the given one.otherBounds - The given bound.true if the rectangle contains the given one.public boolean contains(Point point)
true if the rectangle contains the given point.point - The given point.true if the rectangle contains the given point.public boolean intersects(Bounds otherBounds)
true if the rectangle intersects the given bounds.otherBounds - The given bound.true if the rectangle intersects the given bounds.public boolean isValid()
true if the bounds are properly initialized.true if the bounds are properly initialized.public Point getSize()
Copyright © 2017. All rights reserved.