Interface RectangularShape2ai<ST extends Shape2ai<?,?,IE,P,V,B>,IT extends RectangularShape2ai<?,?,IE,P,V,B>,IE extends PathElement2ai,P extends Point2D<? super P,? super V>,V extends Vector2D<? super V,? super P>,B extends Rectangle2ai<?,?,IE,P,V,B>>
-
- Type Parameters:
ST
- is the type of the general implementation.IT
- is the type of the implementation of this shape.IE
- is the type of the path elements.P
- is the type of the points.V
- is the type of the vectors.B
- is the type of the bounding boxes.
- All Superinterfaces:
Cloneable
,JsonableObject
,Serializable
,Shape2ai<ST,IT,IE,P,V,B>
,Shape2D<ST,IT,PathIterator2ai<IE>,P,V,B>
- All Known Subinterfaces:
Rectangle2ai<ST,IT,IE,P,V,B>
- All Known Implementing Classes:
AbstractRectangularShape2i
,AbstractRectangularShape2ifx
,Rectangle2i
,Rectangle2ifx
public interface RectangularShape2ai<ST extends Shape2ai<?,?,IE,P,V,B>,IT extends RectangularShape2ai<?,?,IE,P,V,B>,IE extends PathElement2ai,P extends Point2D<? super P,? super V>,V extends Vector2D<? super V,? super P>,B extends Rectangle2ai<?,?,IE,P,V,B>> extends Shape2ai<ST,IT,IE,P,V,B>
Fonctional interface that represented a rectangular shape on a plane.- Since:
- 13.0
- Version:
- 17.0 2020-01-04 14:41:43
- Author:
- Stéphane GALLAND, Hamza JAFFALI
- Maven Group Id:
- org.arakhne.afc.core
- Maven Artifact Id:
- mathgeom
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default void
clear()
Reset this shape to be equivalent to an just-created instance of this shape type.default P
getCenter()
Replies the center.default int
getCenterX()
Replies the center x.default int
getCenterY()
Replies the center y.default int
getHeight()
Replies the height.int
getMaxX()
Replies the max x.int
getMaxY()
Replies the max y.int
getMinX()
Replies the min X.int
getMinY()
Replies the min y.default int
getWidth()
Replies the width.default void
inflate(int minXBorder, int minYBorder, int maxXBorder, int maxYBorder)
Inflate this rectangle with the given amounts.default boolean
isEmpty()
Replies if this shape is empty.default void
set(int x, int y, int width, int height)
Change the frame of the rectangle.default void
set(Point2D<?,?> min, Point2D<?,?> max)
Change the frame of the rectangle.default void
setFromCenter(int centerX, int centerY, int cornerX, int cornerY)
Sets the framing rectangle of thisShape
based on the specified center point coordinates and corner point coordinates.default void
setFromCenter(Point2D<?,?> center, Point2D<?,?> corner)
Sets the framing rectangle of thisShape
based on the specified center point coordinates and corner point coordinates.void
setFromCorners(int x1, int y1, int x2, int y2)
Change the frame of the rectangle conserving previous min and max if needed.default void
setFromCorners(Point2D<?,?> p1, Point2D<?,?> p2)
Change the frame of the rectangle conserving previous min and max if needed.default void
setHeight(int height)
Change the height of the rectangle, not the min corner.void
setMaxX(int x)
Set the max X conserving previous max if needed.void
setMaxY(int y)
Set the max Y conserving previous max if needed.void
setMinX(int x)
Set the min X conserving previous min if needed.void
setMinY(int y)
Set the min Y conserving previous min if needed.default void
setWidth(int width)
Change the width of the rectangle, not the min corner.default void
toBoundingBox(B box)
Replies the bounds of the shape.default void
translate(int dx, int dy)
Translate the shape.-
Methods inherited from interface org.arakhne.afc.vmutil.json.JsonableObject
toJson
-
Methods inherited from interface org.arakhne.afc.math.geometry.d2.ai.Shape2ai
contains, contains, contains, contains, createTransformedShape, getClosestPointTo, getClosestPointTo, getClosestPointTo, getClosestPointTo, getClosestPointTo, getClosestPointTo, getDistanceSquared, getDistanceSquared, getDistanceSquared, getDistanceSquared, getDistanceSquared, getDistanceSquared, getGeomFactory, getPointIterator, intersects, intersects, intersects, intersects, intersects, intersects, intersects, toBoundingBox, translate
-
Methods inherited from interface org.arakhne.afc.math.geometry.d2.Shape2D
clone, equalsToPathIterator, equalsToShape, getClosestPointTo, getDistance, getDistance, getDistanceL1, getDistanceLinf, getDistanceSquared, getFarthestPointTo, getPathIterator, getPathIterator, operator_add, operator_and, operator_and, operator_minus, operator_multiply, operator_plus, operator_remove, operator_upTo, set
-
-
-
-
Method Detail
-
toBoundingBox
default void toBoundingBox(B box)
Description copied from interface:Shape2D
Replies the bounds of the shape.- Specified by:
toBoundingBox
in interfaceShape2D<ST extends Shape2ai<?,?,IE,P,V,B>,IT extends RectangularShape2ai<?,?,IE,P,V,B>,IE extends PathElement2ai,P extends Point2D<? super P,? super V>,V extends Vector2D<? super V,? super P>,B extends Rectangle2ai<?,?,IE,P,V,B>>
- Parameters:
box
- is set with the bounds of the shape.
-
clear
default void clear()
Description copied from interface:Shape2D
Reset this shape to be equivalent to an just-created instance of this shape type.
-
set
default void set(int x, int y, int width, int height)
Change the frame of the rectangle.- Parameters:
x
- x coordinate of the lower corner.y
- y coordinate of the lower corner.width
- width of the rectangular shape.height
- height of the rectangular shape.
-
set
default void set(Point2D<?,?> min, Point2D<?,?> max)
Change the frame of the rectangle.- Parameters:
min
- is the min corner of the rectangle.max
- is the max corner of the rectangle.
-
setWidth
default void setWidth(int width)
Change the width of the rectangle, not the min corner.- Parameters:
width
- width of the rectangular shape.
-
setHeight
default void setHeight(int height)
Change the height of the rectangle, not the min corner.- Parameters:
height
- height of the rectangular shape.
-
setFromCorners
void setFromCorners(int x1, int y1, int x2, int y2)
Change the frame of the rectangle conserving previous min and max if needed.- Parameters:
x1
- is the coordinate of the first corner.y1
- is the coordinate of the first corner.x2
- is the coordinate of the second corner.y2
- is the coordinate of the second corner.
-
setFromCorners
default void setFromCorners(Point2D<?,?> p1, Point2D<?,?> p2)
Change the frame of the rectangle conserving previous min and max if needed.- Parameters:
p1
- the first corner.p2
- the second corner.
-
setFromCenter
default void setFromCenter(int centerX, int centerY, int cornerX, int cornerY)
Sets the framing rectangle of thisShape
based on the specified center point coordinates and corner point coordinates. The framing rectangle is used by the subclasses ofRectangularShape
to define their geometry.- Parameters:
centerX
- the X coordinate of the specified center pointcenterY
- the Y coordinate of the specified center pointcornerX
- the X coordinate of the specified corner pointcornerY
- the Y coordinate of the specified corner point
-
setFromCenter
default void setFromCenter(Point2D<?,?> center, Point2D<?,?> corner)
Sets the framing rectangle of thisShape
based on the specified center point coordinates and corner point coordinates. The framing rectangle is used by the subclasses ofRectangularShape
to define their geometry.- Parameters:
center
- the specified center pointcorner
- the specified corner point
-
getMinX
@Pure int getMinX()
Replies the min X.- Returns:
- the min x.
-
setMinX
void setMinX(int x)
Set the min X conserving previous min if needed.- Parameters:
x
- the min x.
-
getCenterX
@Pure default int getCenterX()
Replies the center x.- Returns:
- the center x.
-
getCenter
@Pure default P getCenter()
Replies the center.- Returns:
- the center.
-
getMaxX
@Pure int getMaxX()
Replies the max x.- Returns:
- the max x.
-
setMaxX
void setMaxX(int x)
Set the max X conserving previous max if needed.- Parameters:
x
- the max x.
-
getMinY
@Pure int getMinY()
Replies the min y.- Returns:
- the min y.
-
setMinY
void setMinY(int y)
Set the min Y conserving previous min if needed.- Parameters:
y
- the min y.
-
getCenterY
@Pure default int getCenterY()
Replies the center y.- Returns:
- the center y.
-
getMaxY
@Pure int getMaxY()
Replies the max y.- Returns:
- the max y.
-
setMaxY
void setMaxY(int y)
Set the max Y conserving previous max if needed.- Parameters:
y
- the max y.
-
getWidth
@Pure default int getWidth()
Replies the width.- Returns:
- the width.
-
getHeight
@Pure default int getHeight()
Replies the height.- Returns:
- the height.
-
translate
default void translate(int dx, int dy)
Description copied from interface:Shape2ai
Translate the shape.- Specified by:
translate
in interfaceShape2ai<ST extends Shape2ai<?,?,IE,P,V,B>,IT extends RectangularShape2ai<?,?,IE,P,V,B>,IE extends PathElement2ai,P extends Point2D<? super P,? super V>,V extends Vector2D<? super V,? super P>,B extends Rectangle2ai<?,?,IE,P,V,B>>
- Parameters:
dx
- x translation.dy
- y translation.
-
isEmpty
@Pure default boolean isEmpty()
Description copied from interface:Shape2D
Replies if this shape is empty. The semantic associated to the state "empty" depends on the implemented shape. See the subclasses for details.- Specified by:
isEmpty
in interfaceShape2D<ST extends Shape2ai<?,?,IE,P,V,B>,IT extends RectangularShape2ai<?,?,IE,P,V,B>,IE extends PathElement2ai,P extends Point2D<? super P,? super V>,V extends Vector2D<? super V,? super P>,B extends Rectangle2ai<?,?,IE,P,V,B>>
- Returns:
true
if the shape is empty;false
otherwise.
-
inflate
default void inflate(int minXBorder, int minYBorder, int maxXBorder, int maxYBorder)
Inflate this rectangle with the given amounts.The four borders may be inflated. If the value associated to a border is positive, the border is moved outside the current rectangle. If the value is negative, the border is moved inside the rectangle.
- Parameters:
minXBorder
- the value to substract to the minimum x.minYBorder
- the value to substract to the minimum y.maxXBorder
- the value to add to the maximum x.maxYBorder
- the value to add to the maximum y.
-
-