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 void
ensureValidArcHeight()
Ensure that the size of the arc height is valid, i.e. not too big or too small.protected void
ensureValidArcWidth()
Ensure that the size of the arc width is valid, i.e. not too big or too small.double
getArcHeight()
Gets the height of the arc that rounds off the corners.double
getArcWidth()
Gets the width of the arc that rounds off the corners.int
hashCode()
void
setArcHeight(double arcHeight)
Set the height of the arc that rounds off the corners.void
setArcWidth(double arcWidth)
Set the width of the arc that rounds off the corners.void
setFromCorners(double x1, double y1, double x2, double y2)
Change the frame of the rectangle conserving previous min and max if needed.void
setFromCorners(double x1, double y1, double x2, double y2, double arcWidth, double arcHeight)
Change the frame of the rectangle.void
setMaxX(double x)
Set the max X conserving previous max if needed.void
setMaxY(double y)
Set the max Y conserving previous max if needed.void
setMinX(double x)
Set the min X conserving previous min if needed.void
setMinY(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:
hashCode
in classAbstractRectangularShape2d<RoundRectangle2d>
-
getArcWidth
@Pure public double getArcWidth()
Description copied from interface:RoundRectangle2afp
Gets the width of the arc that rounds off the corners.- Specified by:
getArcWidth
in 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:RoundRectangle2afp
Gets the height of the arc that rounds off the corners.- Specified by:
getArcHeight
in 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:RoundRectangle2afp
Set the width of the arc that rounds off the corners.- Specified by:
setArcWidth
in 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:RoundRectangle2afp
Set the height of the arc that rounds off the corners.- Specified by:
setArcHeight
in 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:RectangularShape2afp
Change the frame of the rectangle conserving previous min and max if needed.- Specified by:
setFromCorners
in interfaceRectangularShape2afp<Shape2d<?>,RoundRectangle2d,PathElement2d,Point2d,Vector2d,Rectangle2d>
- Overrides:
setFromCorners
in 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:RoundRectangle2afp
Change the frame of the rectangle.- Specified by:
setFromCorners
in 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:RectangularShape2afp
Set the min X conserving previous min if needed.- Specified by:
setMinX
in interfaceRectangularShape2afp<Shape2d<?>,RoundRectangle2d,PathElement2d,Point2d,Vector2d,Rectangle2d>
- Overrides:
setMinX
in classAbstractRectangularShape2d<RoundRectangle2d>
- Parameters:
x
- the min x.
-
setMaxX
public void setMaxX(double x)
Description copied from interface:RectangularShape2afp
Set the max X conserving previous max if needed.- Specified by:
setMaxX
in interfaceRectangularShape2afp<Shape2d<?>,RoundRectangle2d,PathElement2d,Point2d,Vector2d,Rectangle2d>
- Overrides:
setMaxX
in classAbstractRectangularShape2d<RoundRectangle2d>
- Parameters:
x
- the max x.
-
setMinY
public void setMinY(double y)
Description copied from interface:RectangularShape2afp
Set the min Y conserving previous min if needed.- Specified by:
setMinY
in interfaceRectangularShape2afp<Shape2d<?>,RoundRectangle2d,PathElement2d,Point2d,Vector2d,Rectangle2d>
- Overrides:
setMinY
in classAbstractRectangularShape2d<RoundRectangle2d>
- Parameters:
y
- the min y.
-
setMaxY
public void setMaxY(double y)
Description copied from interface:RectangularShape2afp
Set the max Y conserving previous max if needed.- Specified by:
setMaxY
in interfaceRectangularShape2afp<Shape2d<?>,RoundRectangle2d,PathElement2d,Point2d,Vector2d,Rectangle2d>
- Overrides:
setMaxY
in classAbstractRectangularShape2d<RoundRectangle2d>
- Parameters:
y
- the max y.
-
-