Interface RectangularShape1afp<ST extends Shape1afp<?,?,P,V,S,B>,IT extends RectangularShape1afp<?,?,P,V,S,B>,P extends Point1D<? super P,? super V,? super S>,V extends Vector1D<? super V,? super P,? super S>,S extends Segment1D<?,?>,B extends Rectangle1afp<?,?,P,V,S,B>>
-
- Type Parameters:
ST- is the type of the general implementation.IT- is the type of the implementation of this shape.P- is the type of the points.V- is the type of the vectors.S- is the type of the segment.B- is the type of the bounding boxes.
- All Superinterfaces:
Cloneable,JsonableObject,Serializable,Shape1afp<ST,IT,P,V,S,B>,Shape1D<ST,IT,P,V,S,B>
- All Known Subinterfaces:
Rectangle1afp<ST,IT,P,V,S,B>
- All Known Implementing Classes:
AbstractRectangularShape1d,AbstractRectangularShape1dfx,Rectangle1d,Rectangle1dfx
public interface RectangularShape1afp<ST extends Shape1afp<?,?,P,V,S,B>,IT extends RectangularShape1afp<?,?,P,V,S,B>,P extends Point1D<? super P,? super V,? super S>,V extends Vector1D<? super V,? super P,? super S>,S extends Segment1D<?,?>,B extends Rectangle1afp<?,?,P,V,S,B>> extends Shape1afp<ST,IT,P,V,S,B>
Fonctional interface that represented a rectangular shape on a plane.- Since:
- 14.0
- Version:
- 17.0 2020-01-04 14:41:43
- Author:
- Stéphane GALLAND
- 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 voidclear()Reset this shape to be equivalent to an just-created instance of this shape type.default PgetCenter()Replies the center.default doublegetCenterX()Replies the center x.default doublegetCenterY()Replies the center y.default doublegetHeight()Replies the height.doublegetMaxX()Replies the max x.doublegetMaxY()Replies the max y.doublegetMinX()Replies the min X.doublegetMinY()Replies the min y.default doublegetWidth()Replies the width.default voidinflate(double minXBorder, double minYBorder, double maxXBorder, double maxYBorder)Inflate this rectangle with the given amounts.default booleanisEmpty()Replies if this shape is empty.default voidset(double x, double y, double width, double height)Change the frame of the rectangle.default voidset(IT shape)Set this shape with the attributes of the given shape.default voidset(Point2D<?,?> min, Point2D<?,?> max)Change the frame of the rectangle.default voidsetFromCenter(double centerX, double centerY, double cornerX, double cornerY)Sets the framing rectangle of thisShapebased on the specified center point coordinates and corner point coordinates.default voidsetFromCenter(Point2D<?,?> center, Point2D<?,?> corner)Sets the framing rectangle of thisShapebased on the specified center point coordinates and corner point coordinates.voidsetFromCorners(double x1, double y1, double x2, double y2)Change the frame of the rectangle conserving previous min and max if needed.default voidsetFromCorners(Point2D<?,?> p1, Point2D<?,?> p2)Change the frame of the rectangle conserving previous min and max if needed.default voidsetHeight(double height)Change the height of the rectangle, not the min corner.voidsetMaxX(double x)Set the max X conserving previous max if needed.voidsetMaxY(double y)Set the max Y conserving previous max if needed.voidsetMinX(double x)Set the min X conserving previous min if needed.voidsetMinY(double y)Set the min Y conserving previous min if needed.default voidsetWidth(double width)Change the width of the rectangle, not the min corner.default voidtoBoundingBox(B box)Replies the bounds of the shape.default voidtranslate(double dx, double dy)Translate the shape.-
Methods inherited from interface org.arakhne.afc.vmutil.json.JsonableObject
toJson
-
Methods inherited from interface org.arakhne.afc.math.geometry.d1.afp.Shape1afp
contains, contains, contains, contains, getClosestPointTo, getClosestPointTo, getDistanceSquared, getDistanceSquared, getGeomFactory, intersects, intersects, toBoundingBox, translate
-
Methods inherited from interface org.arakhne.afc.math.geometry.d1.Shape1D
clone, equalsToShape, getClosestPointTo, getDistance, getDistance, getDistanceL1, getDistanceLinf, getDistanceSquared, getFarthestPointTo, getSegment, operator_add, operator_and, operator_and, operator_minus, operator_plus, operator_remove, operator_upTo, setSegment
-
-
-
-
Method Detail
-
toBoundingBox
default void toBoundingBox(B box)
Description copied from interface:Shape1DReplies the bounds of the shape.- Specified by:
toBoundingBoxin interfaceShape1D<ST extends Shape1afp<?,?,P,V,S,B>,IT extends RectangularShape1afp<?,?,P,V,S,B>,P extends Point1D<? super P,? super V,? super S>,V extends Vector1D<? super V,? super P,? super S>,S extends Segment1D<?,?>,B extends Rectangle1afp<?,?,P,V,S,B>>- Parameters:
box- is set with the bounds of the shape.
-
clear
default void clear()
Description copied from interface:Shape1DReset this shape to be equivalent to an just-created instance of this shape type.- Specified by:
clearin interfaceShape1D<ST extends Shape1afp<?,?,P,V,S,B>,IT extends RectangularShape1afp<?,?,P,V,S,B>,P extends Point1D<? super P,? super V,? super S>,V extends Vector1D<? super V,? super P,? super S>,S extends Segment1D<?,?>,B extends Rectangle1afp<?,?,P,V,S,B>>
-
set
default void set(double x, double y, double width, double height)Change the frame of the rectangle.- Parameters:
x- x coordinate of the lower corner of the rectangular shape.y- y coordinate of the lower corner of the rectangular shape.width- width of the rectangular shape.height- height of the rectangular shape.
-
set
default void set(IT shape)
Description copied from interface:Shape1DSet this shape with the attributes of the given shape.- Specified by:
setin interfaceShape1D<ST extends Shape1afp<?,?,P,V,S,B>,IT extends RectangularShape1afp<?,?,P,V,S,B>,P extends Point1D<? super P,? super V,? super S>,V extends Vector1D<? super V,? super P,? super S>,S extends Segment1D<?,?>,B extends Rectangle1afp<?,?,P,V,S,B>>- Parameters:
shape- the shape to copy.
-
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(double width)
Change the width of the rectangle, not the min corner.- Parameters:
width- width of the rectangular shape.
-
setHeight
default void setHeight(double height)
Change the height of the rectangle, not the min corner.- Parameters:
height- height of the rectangular shape.
-
setFromCorners
void setFromCorners(double x1, double y1, double x2, double 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(double centerX, double centerY, double cornerX, double cornerY)Sets the framing rectangle of thisShapebased on the specified center point coordinates and corner point coordinates. The framing rectangle is used by the subclasses ofRectangularShapeto 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 thisShapebased on the specified center point coordinates and corner point coordinates. The framing rectangle is used by the subclasses ofRectangularShapeto define their geometry.- Parameters:
center- the specified center pointcorner- the specified corner point
-
getMinX
@Pure double getMinX()
Replies the min X.- Returns:
- the min x.
-
setMinX
void setMinX(double x)
Set the min X conserving previous min if needed.- Parameters:
x- the min x.
-
getCenter
@Pure default P getCenter()
Replies the center.- Returns:
- the center.
-
getCenterX
@Pure default double getCenterX()
Replies the center x.- Returns:
- the center x.
-
getMaxX
@Pure double getMaxX()
Replies the max x.- Returns:
- the max x.
-
setMaxX
void setMaxX(double x)
Set the max X conserving previous max if needed.- Parameters:
x- the max x.
-
getMinY
@Pure double getMinY()
Replies the min y.- Returns:
- the min y.
-
setMinY
void setMinY(double y)
Set the min Y conserving previous min if needed.- Parameters:
y- the min y.
-
getCenterY
@Pure default double getCenterY()
Replies the center y.- Returns:
- the center y.
-
getMaxY
@Pure double getMaxY()
Replies the max y.- Returns:
- the max y.
-
setMaxY
void setMaxY(double y)
Set the max Y conserving previous max if needed.- Parameters:
y- the max y.
-
getWidth
@Pure default double getWidth()
Replies the width.- Returns:
- the width.
-
getHeight
@Pure default double getHeight()
Replies the height.- Returns:
- the height.
-
translate
default void translate(double dx, double dy)Description copied from interface:Shape1afpTranslate the shape.- Specified by:
translatein interfaceShape1afp<ST extends Shape1afp<?,?,P,V,S,B>,IT extends RectangularShape1afp<?,?,P,V,S,B>,P extends Point1D<? super P,? super V,? super S>,V extends Vector1D<? super V,? super P,? super S>,S extends Segment1D<?,?>,B extends Rectangle1afp<?,?,P,V,S,B>>- Parameters:
dx- x translation.dy- y translation.
-
isEmpty
@Pure default boolean isEmpty()
Description copied from interface:Shape1DReplies if this shape is empty. The semantic associated to the state "empty" depends on the implemented shape. See the subclasses for details.- Specified by:
isEmptyin interfaceShape1D<ST extends Shape1afp<?,?,P,V,S,B>,IT extends RectangularShape1afp<?,?,P,V,S,B>,P extends Point1D<? super P,? super V,? super S>,V extends Vector1D<? super V,? super P,? super S>,S extends Segment1D<?,?>,B extends Rectangle1afp<?,?,P,V,S,B>>- Returns:
trueif the shape is empty;falseotherwise.
-
inflate
default void inflate(double minXBorder, double minYBorder, double maxXBorder, double 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.
-
-