Class RoundRectangle2d
- java.lang.Object
-
- org.arakhne.afc.math.geometry.d2.d.AbstractShape2d<IT>
-
- org.arakhne.afc.math.geometry.d2.d.AbstractRectangularShape2d<RoundRectangle2d>
-
- org.arakhne.afc.math.geometry.d2.d.RoundRectangle2d
-
- All Implemented Interfaces:
Serializable,Cloneable,RectangularShape2afp<Shape2d<?>,RoundRectangle2d,PathElement2d,Point2d,Vector2d,Rectangle2d>,RoundRectangle2afp<Shape2d<?>,RoundRectangle2d,PathElement2d,Point2d,Vector2d,Rectangle2d>,Shape2afp<Shape2d<?>,RoundRectangle2d,PathElement2d,Point2d,Vector2d,Rectangle2d>,Shape2d<RoundRectangle2d>,Shape2D<Shape2d<?>,RoundRectangle2d,PathIterator2afp<PathElement2d>,Point2d,Vector2d,Rectangle2d>,JsonableObject
public class RoundRectangle2d extends AbstractRectangularShape2d<RoundRectangle2d> implements RoundRectangle2afp<Shape2d<?>,RoundRectangle2d,PathElement2d,Point2d,Vector2d,Rectangle2d>
A round rectangle with 2 double precision floating-point numbers.- Since:
- 13.0
- Version:
- 17.0 2020-01-04 14:41:43
- Author:
- Stéphane GALLAND
- See Also:
- Serialized Form
- Maven Group Id:
- org.arakhne.afc.core
- Maven Artifact Id:
- mathgeom
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.arakhne.afc.math.geometry.d2.afp.RoundRectangle2afp
RoundRectangle2afp.AbstractRoundRectanglePathIterator<T extends PathElement2afp>, RoundRectangle2afp.RoundRectanglePathIterator<T extends PathElement2afp>, RoundRectangle2afp.TransformedRoundRectanglePathIterator<T extends PathElement2afp>
-
-
Constructor Summary
Constructors Constructor Description RoundRectangle2d()Construct an empty round rectangle.RoundRectangle2d(double x, double y, double width, double height, double arcWidth, double arcHeight)Construct a round rectangle with the given corners and arcs.RoundRectangle2d(RectangularShape2afp<?,?,?,?,?,?> shape)Construct a round rectangle with the corners of the given shape, and zero arcs.RoundRectangle2d(RoundRectangle2afp<?,?,?,?,?,?> roundRectangle)Constructor by copy.RoundRectangle2d(Point2D<?,?> min, Point2D<?,?> max, double arcWidth, double arcHeight)Construct a round rectangle with the given corners and arcs.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidensureValidArcHeight()Ensure that the size of the arc height is valid, i.e. not too big or too small.protected voidensureValidArcWidth()Ensure that the size of the arc width is valid, i.e. not too big or too small.doublegetArcHeight()Gets the height of the arc that rounds off the corners.doublegetArcWidth()Gets the width of the arc that rounds off the corners.inthashCode()voidsetArcHeight(double arcHeight)Set the height of the arc that rounds off the corners.voidsetArcWidth(double arcWidth)Set the width of the arc that rounds off the corners.voidsetFromCorners(double x1, double y1, double x2, double y2)Change the frame of the rectangle conserving previous min and max if needed.voidsetFromCorners(double x1, double y1, double x2, double y2, double arcWidth, double arcHeight)Change the frame of the rectangle.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.-
Methods inherited from class org.arakhne.afc.math.geometry.d2.d.AbstractRectangularShape2d
getMaxX, getMaxY, getMinX, getMinY
-
Methods inherited from class org.arakhne.afc.math.geometry.d2.d.AbstractShape2d
addShapeGeometryChangeListener, clone, equals, fireGeometryChange, getGeomFactory, removeShapeGeometryChangeListener, toJson, toString
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.arakhne.afc.vmutil.json.JsonableObject
toJson
-
Methods inherited from interface org.arakhne.afc.math.geometry.d2.afp.RectangularShape2afp
clear, getCenter, getCenterX, getCenterY, getHeight, getMaxX, getMaxY, getMinX, getMinY, getWidth, inflate, isEmpty, set, set, setFromCenter, setFromCenter, setFromCorners, setHeight, setWidth, toBoundingBox, translate
-
Methods inherited from interface org.arakhne.afc.math.geometry.d2.afp.RoundRectangle2afp
contains, contains, equalsToShape, getClosestPointTo, getClosestPointTo, getClosestPointTo, getClosestPointTo, getClosestPointTo, getClosestPointTo, getClosestPointTo, getClosestPointTo, getClosestPointTo, getClosestPointTo, getDistanceL1, getDistanceLinf, getDistanceSquared, getFarthestPointTo, getFlatteningPathIterator, getPathIterator, intersects, intersects, intersects, intersects, intersects, intersects, intersects, intersects, intersects, intersects, set, set
-
Methods inherited from interface org.arakhne.afc.math.geometry.d2.afp.Shape2afp
contains, contains, createTransformedShape, getClosestPointTo, getClosestPointTo, getDistanceSquared, getDistanceSquared, getDistanceSquared, getDistanceSquared, getDistanceSquared, getDistanceSquared, getDistanceSquared, getDistanceSquared, getDistanceSquared, getDistanceSquared, getDistanceSquared, getGeomFactory, intersects, intersects, toBoundingBox, translate
-
Methods inherited from interface org.arakhne.afc.math.geometry.d2.Shape2D
clone, equalsToPathIterator, getDistance, getDistance, getPathIterator, operator_add, operator_and, operator_and, operator_minus, operator_multiply, operator_plus, operator_remove, operator_upTo
-
-
-
-
Constructor Detail
-
RoundRectangle2d
public RoundRectangle2d()
Construct an empty round rectangle.
-
RoundRectangle2d
public RoundRectangle2d(Point2D<?,?> min, Point2D<?,?> max, double arcWidth, double arcHeight)
Construct a round rectangle with the given corners and arcs.- Parameters:
min- is the min corner of the rectangle.max- is the max corner of the rectangle.arcWidth- the width of the arcs.arcHeight- the height of the arcs.
-
RoundRectangle2d
public RoundRectangle2d(RoundRectangle2afp<?,?,?,?,?,?> roundRectangle)
Constructor by copy.- Parameters:
roundRectangle- the round rectangle to copy.
-
RoundRectangle2d
public RoundRectangle2d(RectangularShape2afp<?,?,?,?,?,?> shape)
Construct a round rectangle with the corners of the given shape, and zero arcs.- Parameters:
shape- the shape to copy.
-
RoundRectangle2d
public RoundRectangle2d(double x, double y, double width, double height, double arcWidth, double arcHeight)Construct a round rectangle with the given corners and arcs.- Parameters:
x- x coordinate of the minimum corner.y- y coordinate of the minimum corner.width- width of the rectangle.height- height of the rectangle.arcWidth- width of the arcs.arcHeight- height of the arcs.
-
-
Method Detail
-
hashCode
@Pure public int hashCode()
- Overrides:
hashCodein classAbstractRectangularShape2d<RoundRectangle2d>
-
getArcWidth
@Pure public double getArcWidth()
Description copied from interface:RoundRectangle2afpGets the width of the arc that rounds off the corners.- Specified by:
getArcWidthin interfaceRoundRectangle2afp<Shape2d<?>,RoundRectangle2d,PathElement2d,Point2d,Vector2d,Rectangle2d>- Returns:
- the width of the arc that rounds off the corners
of this
RoundRectangle2afp.
-
getArcHeight
@Pure public double getArcHeight()
Description copied from interface:RoundRectangle2afpGets the height of the arc that rounds off the corners.- Specified by:
getArcHeightin interfaceRoundRectangle2afp<Shape2d<?>,RoundRectangle2d,PathElement2d,Point2d,Vector2d,Rectangle2d>- Returns:
- the height of the arc that rounds off the corners
of this
RoundRectangle2afp.
-
setArcWidth
public void setArcWidth(double arcWidth)
Description copied from interface:RoundRectangle2afpSet the width of the arc that rounds off the corners.- Specified by:
setArcWidthin interfaceRoundRectangle2afp<Shape2d<?>,RoundRectangle2d,PathElement2d,Point2d,Vector2d,Rectangle2d>- Parameters:
arcWidth- is the width of the arc that rounds off the corners of thisRoundRectangle2afp.
-
setArcHeight
public void setArcHeight(double arcHeight)
Description copied from interface:RoundRectangle2afpSet the height of the arc that rounds off the corners.- Specified by:
setArcHeightin interfaceRoundRectangle2afp<Shape2d<?>,RoundRectangle2d,PathElement2d,Point2d,Vector2d,Rectangle2d>- Parameters:
arcHeight- is the height of the arc that rounds off the corners of thisRoundRectangle2afp.
-
setFromCorners
public void setFromCorners(double x1, double y1, double x2, double y2)Description copied from interface:RectangularShape2afpChange the frame of the rectangle conserving previous min and max if needed.- Specified by:
setFromCornersin interfaceRectangularShape2afp<Shape2d<?>,RoundRectangle2d,PathElement2d,Point2d,Vector2d,Rectangle2d>- Overrides:
setFromCornersin classAbstractRectangularShape2d<RoundRectangle2d>- 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
public void setFromCorners(double x1, double y1, double x2, double y2, double arcWidth, double arcHeight)Description copied from interface:RoundRectangle2afpChange the frame of the rectangle.- Specified by:
setFromCornersin interfaceRoundRectangle2afp<Shape2d<?>,RoundRectangle2d,PathElement2d,Point2d,Vector2d,Rectangle2d>- 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.arcWidth- is the width of the arc that rounds off the corners of thisRoundRectangle2afp.arcHeight- is the height of the arc that rounds off the corners of thisRoundRectangle2afp.
-
ensureValidArcWidth
protected void ensureValidArcWidth()
Ensure that the size of the arc width is valid, i.e. not too big or too small.
-
ensureValidArcHeight
protected void ensureValidArcHeight()
Ensure that the size of the arc height is valid, i.e. not too big or too small.
-
setMinX
public void setMinX(double x)
Description copied from interface:RectangularShape2afpSet the min X conserving previous min if needed.- Specified by:
setMinXin interfaceRectangularShape2afp<Shape2d<?>,RoundRectangle2d,PathElement2d,Point2d,Vector2d,Rectangle2d>- Overrides:
setMinXin classAbstractRectangularShape2d<RoundRectangle2d>- Parameters:
x- the min x.
-
setMaxX
public void setMaxX(double x)
Description copied from interface:RectangularShape2afpSet the max X conserving previous max if needed.- Specified by:
setMaxXin interfaceRectangularShape2afp<Shape2d<?>,RoundRectangle2d,PathElement2d,Point2d,Vector2d,Rectangle2d>- Overrides:
setMaxXin classAbstractRectangularShape2d<RoundRectangle2d>- Parameters:
x- the max x.
-
setMinY
public void setMinY(double y)
Description copied from interface:RectangularShape2afpSet the min Y conserving previous min if needed.- Specified by:
setMinYin interfaceRectangularShape2afp<Shape2d<?>,RoundRectangle2d,PathElement2d,Point2d,Vector2d,Rectangle2d>- Overrides:
setMinYin classAbstractRectangularShape2d<RoundRectangle2d>- Parameters:
y- the min y.
-
setMaxY
public void setMaxY(double y)
Description copied from interface:RectangularShape2afpSet the max Y conserving previous max if needed.- Specified by:
setMaxYin interfaceRectangularShape2afp<Shape2d<?>,RoundRectangle2d,PathElement2d,Point2d,Vector2d,Rectangle2d>- Overrides:
setMaxYin classAbstractRectangularShape2d<RoundRectangle2d>- Parameters:
y- the max y.
-
-