public interface IMutableRectangle extends IMutableSize, IMutablePoint, IRectangle
This interface provides read and write access to the features of the rectangle. This interface does not declare any
additional methods. It combines the IMutablePoint
interface that describes the upper left corner of the
rectangle with the IMutableSize
interface that describes the width and height of the rectangle.
ISize
,
IPoint
,
MutableRectangle
Modifier and Type | Method and Description |
---|---|
default void |
add(IPoint point)
Adds a point to a rectangle, possibly enlarging the rectangle.
|
default void |
add(IRectangle rectangle2)
Adds a rectangle to another one.
|
default IMutablePoint |
getDynamicCenter()
Create a dynamic
IMutablePoint implementation that always points to the center of the given rectangle. |
default void |
reshape(double x,
double y,
double width,
double height)
Applies a new position and size to a given mutable rectangle.
|
default void |
reshape(IPoint position,
ISize size)
Applies a new position and size to a given mutable rectangle.
|
default void |
reshape(IRectangle newRectangle)
Applies a new position and size to a given mutable rectangle.
|
default void |
reshape(RectD newRectangle)
Applies a new position and size to a given mutable rectangle.
|
default void |
resize(SizeD size)
Sets the size of the rectangle to the values of a
SizeD struct. |
default void |
setCenter(PointD center)
Sets the center of the rectangle to the provided value.
|
default void |
setToUnion(IRectangle rectangle1,
IRectangle rectangle2)
Creates the union of two rectangles, placing the result in the this parameter.
|
getHeight, getWidth, resize, resize, setHeight, setWidth
getX, getY, relocate, relocate, relocate, setX, setY
contains, contains, getBottomLeft, getBottomRight, getCenter, getDynamicPoint, getMaxX, getMaxY, getTopLeft, getTopRight, isEmpty, toRectD, toSizeD
distanceTo, toPointD
default void add(IPoint point)
If the rectangle is initially empty, i.e. its width or height is negative, the bounds of the rectangle will be set to (p.x, p.y, 0, 0)
point
- The coordinate to include in the bounds.default void add(IRectangle rectangle2)
The result is placed into the first rectangle, which is returned. If either of the two rectangles is empty, i.e. it's width or height is negative, the result will be the other rectangle.
rectangle2
- The rectangle to be added.default IMutablePoint getDynamicCenter()
IMutablePoint
implementation that always points to the center of the given rectangle.
Modifying the point's x and y coordinates, will in fact move the rectangle's position accordingly.
getDynamicCenter
in interface IRectangle
default void reshape(double x, double y, double width, double height)
x
- The new x coordinate of the upper left corner of the rectangle.y
- The new y coordinate of the upper left corner of the rectangle.width
- The new width of the rectangle.height
- The new height of the rectangle.default void reshape(IPoint position, ISize size)
position
- The new location.size
- The new size.default void reshape(IRectangle newRectangle)
newRectangle
- The bounds to set to the rectangle
.default void reshape(RectD newRectangle)
newRectangle
- The bounds to set to the rectangle
.default void resize(SizeD size)
SizeD
struct.resize
in interface IMutableSize
size
- The new size to set to the rectangle.default void setCenter(PointD center)
center
- The new center coordinates.default void setToUnion(IRectangle rectangle1, IRectangle rectangle2)
Either of the two parameters rectangles may be the same as the first parameter. The result is placed into the this parameter. This method treats rectangles with negative width or height as empty.
rectangle1
- The first rectangle to create the union of.rectangle2
- The second rectangle to create the union of.