public final class RadRect extends Object
Constructor and Description |
---|
RadRect() |
RadRect(double width,
double height)
|
RadRect(double x,
double y,
double width,
double height)
Creates an instance of the
RadRect class with specified coordinates and dimensions. |
RadRect(RadPoint point1,
RadPoint point2)
Creates an instance of the
RadRect class with specified top left
and bottom right points. |
Modifier and Type | Method and Description |
---|---|
static RadRect |
centerRect(RadRect rect,
RadRect bounds)
|
boolean |
contains(double x,
double y)
Returns a boolean value determining whether the given point
is part of this RadRect.
|
boolean |
contains(RadRect rect)
Returns a boolean value determining whether the given RadRect
is inside of this RadRect.
|
boolean |
equals(Object o) |
double |
getBottom()
|
RadPoint |
getCenter()
|
static RadRect |
getEmpty()
Gets a
RadRect instance with all of its parameters set to 0.0. |
double |
getHeight() |
RadPoint |
getLocation()
|
double |
getRight()
|
double |
getWidth() |
double |
getX() |
double |
getY() |
static RadRect |
inflate(RadRect rect,
RadThickness margins)
Inflates the bounds of the provided
RadRect instance with the margin
stored in the second RadThickness parameter. |
boolean |
intersectsWith(RadRect rect)
|
boolean |
isSizeValid()
Returns a boolean value determining whether the size of the current
RadRect instance is non-empty. |
static RadRect |
round(RadRect rect)
Performs a rounding of all parameters of the supplied
RadRect instance
by adding 0.5 to them. |
static RadRect |
toSquare(RadRect rect,
boolean offset)
|
String |
toString() |
public RadRect()
public RadRect(double width, double height)
RadRect
class with a specified width
and height
.
The default values of the x
and y
coordinates are 0.0.width
- the width of the rectangle which will be created.height
- the height of the rectangle which will be created.public RadRect(RadPoint point1, RadPoint point2)
RadRect
class with specified top left
and bottom right points.point1
- the top left point depicting the position of the rectangle.point2
- the bottom right point depicting the width and height of the rectangle.public RadRect(double x, double y, double width, double height)
RadRect
class with specified coordinates and dimensions.public double getX()
public double getY()
public double getWidth()
public double getHeight()
public static RadRect getEmpty()
RadRect
instance with all of its parameters set to 0.0. This
depicts an empty rectangle in the Chart engine.RadRect
instance representing the empty rectangle.public static RadRect round(RadRect rect)
RadRect
instance
by adding 0.5 to them.RadRect
instance.public static RadRect toSquare(RadRect rect, boolean offset)
RadRect
representing a square width side length the shortest from the width
or height
.rect
- the RadRect
instance from which to create the square.offset
- determines whether the location of the square will be offset with half the difference
between the width (for the x
coordinate) and height (for the y
coordinate)
and the side of the square.RadRect
instance representing the square.public static RadRect inflate(RadRect rect, RadThickness margins)
RadRect
instance with the margin
stored in the second RadThickness
parameter.rect
- the RadRect
to be inflated.margins
- the RadThickness
instance depicting the margins used for the inflation.RadRect
instance.public double getBottom()
RadRect
instance.public double getRight()
RadRect
instance.public RadPoint getCenter()
public RadPoint getLocation()
RadPoint
class representing the location.public boolean intersectsWith(RadRect rect)
RadRect
instance shares
any common points with the current RadRect
instance.true
if common points exist, otherwise false
.public boolean isSizeValid()
RadRect
instance is non-empty.true
if the size is non-empty, otherwise false
.public boolean contains(double x, double y)
x
- the x coordinate of the point to be checked.y
- the y coordinate of the point to be checked.true
if the point is part of this RadRect
instance, otherwise false
.public boolean contains(RadRect rect)
rect
- the rectangle to be checked.