public interface IRectangle extends ISize, IPoint
This interface provides read access to the features of the rectangle only, however this does not mean that an instance
that implements IRectangle
will always return the same values for its properties. Often times the instance
provides a dynamic read access to the current state of a rectangle. It depends on the context whether it is allowed to
or even necessary to copy the state of the properties or whether the reference to the instance should always be used to
query the values. This interface does not declare any additional methods. It combines the IPoint
interface that
describes the upper left corner of the rectangle with the ISize
interface that describes the width and height of
the rectangle.
IMutableRectangle
,
IMutablePoint
,
ISize
,
IPoint
,
MutableRectangle
Modifier and Type | Method and Description |
---|---|
default boolean |
contains(IPoint point)
Determines whether the given rectangle contains the provided point.
|
default boolean |
contains(PointD point)
Determines whether the given rectangle contains the provided point.
|
default PointD |
getBottomLeft()
Gets the coordinates of the bottom left corner of the rectangle as a
PointD . |
default PointD |
getBottomRight()
Gets the coordinates of the bottom right corner of the rectangle as a
PointD . |
default PointD |
getCenter()
Gets the coordinates of the center of the rectangle as a
PointD . |
default IPoint |
getDynamicCenter()
Create a dynamic
IPoint implementation that always points to the center of the given rectangle. |
default IPoint |
getDynamicPoint(HandlePositions handlePositions)
Create a dynamic
IPoint implementation that always points to the specified position at the given rectangle. |
default double |
getMaxX()
Gets the maximum X coordinate of the rectangle.
|
default double |
getMaxY()
Gets the maximum Y coordinate of the rectangle.
|
default PointD |
getTopLeft()
Gets the coordinates of the top left corner of the rectangle as a
PointD . |
default PointD |
getTopRight()
Gets the coordinates of the top right corner of the rectangle as a
PointD . |
default boolean |
isEmpty()
Determines whether the specified rectangle is empty.
|
default RectD |
toRectD()
Copies the current values of the rectangle to
RectD struct. |
default SizeD |
toSizeD()
Gets the current size of the rectangle as a
SizeD struct. |
distanceTo, getX, getY, toPointD
default boolean contains(IPoint point)
point
- The point to test.true
iff the point lies inside the rectangle.default boolean contains(PointD point)
point
- The point to test.true
iff the point lies inside the rectangle.default PointD getBottomLeft()
PointD
.default PointD getBottomRight()
PointD
.default PointD getCenter()
PointD
.default IPoint getDynamicCenter()
IPoint
implementation that always points to the center of the given rectangle.default IPoint getDynamicPoint(HandlePositions handlePositions)
IPoint
implementation that always points to the specified position at the given rectangle.handlePositions
- The position to use.default double getMaxX()
This is the x coordinate of the right side of the rectangle, or the left side if the rectangle is isEmpty()
.
default double getMaxY()
This is the y coordinate of the bottom side of the rectangle, or the top side if the rectangle is isEmpty()
.
default PointD getTopLeft()
PointD
.default PointD getTopRight()
PointD
.default boolean isEmpty()
IRectangle
instances are considered empty if their Width
or Height
is less than 0.0d
.
true
if the specified rectangle is empty; false
otherwise.default RectD toRectD()
RectD
struct.
This method can be used to obtain a copy of the current state of the rectangle and for using the utility methods that
are available for the RectD
type.
RectD
that holds the values of the rectangle
at the time of the invocation.IMutableRectangle.reshape(double, double, double, double)
,
RectD.toMutableRectangle()