- java.lang.Object
-
- org.arakhne.afc.math.geometry.d1.d.AbstractShape1d<Rectangle1d>
-
- org.arakhne.afc.math.geometry.d1.d.Rectangle1d
-
- All Implemented Interfaces:
Serializable
,Cloneable
,Rectangle1afp<Shape1d<?>,Rectangle1d,Point1d,Vector1d,Segment1D<?,?>,Rectangle1d>
,RectangularShape1afp<Shape1d<?>,Rectangle1d,Point1d,Vector1d,Segment1D<?,?>,Rectangle1d>
,Shape1afp<Shape1d<?>,Rectangle1d,Point1d,Vector1d,Segment1D<?,?>,Rectangle1d>
,Shape1d<Rectangle1d>
,Shape1D<Shape1d<?>,Rectangle1d,Point1d,Vector1d,Segment1D<?,?>,Rectangle1d>
,JsonableObject
public class Rectangle1d extends AbstractShape1d<Rectangle1d> implements Rectangle1afp<Shape1d<?>,Rectangle1d,Point1d,Vector1d,Segment1D<?,?>,Rectangle1d>
A 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
-
-
Constructor Summary
Constructors Constructor Description Rectangle1d()
Construct an empty rectangle.Rectangle1d(Rectangle1d rectangle)
Constructor by copy.Rectangle1d(Point1D<?,?,?> min, Point1D<?,?,?> max)
Construct a rectangle with the given minimum and maxium corners.Rectangle1d(Segment1D<?,?> segment, double x, double y, double width, double height)
Construct a rectangle with the given minimum corner and sizes.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double
getMaxX()
Replies the max x.double
getMaxY()
Replies the max y.double
getMinX()
Replies the min X.double
getMinY()
Replies the min y.int
hashCode()
void
setFromCorners(double x1, double y1, double x2, double y2)
Change the frame of the rectangle conserving previous min and max if needed.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.d1.d.AbstractShape1d
clone, equals, getGeomFactory, getSegment, setSegment, 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.d1.afp.Rectangle1afp
contains, contains, equalsToShape, getClosestPointTo, getClosestPointTo, getDistanceL1, getDistanceLinf, getDistanceSquared, getFarthestPointTo, intersects
-
Methods inherited from interface org.arakhne.afc.math.geometry.d1.afp.RectangularShape1afp
clear, getCenter, getCenterX, getCenterY, getHeight, getWidth, inflate, isEmpty, set, set, set, setFromCenter, setFromCenter, setFromCorners, setHeight, setWidth, toBoundingBox, translate
-
Methods inherited from interface org.arakhne.afc.math.geometry.d1.afp.Shape1afp
contains, contains, getClosestPointTo, getDistanceSquared, getDistanceSquared, getGeomFactory, intersects, toBoundingBox, translate
-
Methods inherited from interface org.arakhne.afc.math.geometry.d1.Shape1D
clone, getDistance, getDistance, getSegment, operator_add, operator_and, operator_and, operator_minus, operator_plus, operator_remove, operator_upTo, setSegment
-
-
-
-
Constructor Detail
-
Rectangle1d
public Rectangle1d()
Construct an empty rectangle.
-
Rectangle1d
public Rectangle1d(Point1D<?,?,?> min, Point1D<?,?,?> max)
Construct a rectangle with the given minimum and maxium corners.- Parameters:
min
- is the min corner of the rectangle.max
- is the max corner of the rectangle.
-
Rectangle1d
public Rectangle1d(Segment1D<?,?> segment, double x, double y, double width, double height)
Construct a rectangle with the given minimum corner and sizes.- Parameters:
segment
- the segment.x
- x coordinate of the minimum corner.y
- y coordinate of the minimum corner.width
- width of the rectangle.height
- height of the rectangle.
-
Rectangle1d
public Rectangle1d(Rectangle1d rectangle)
Constructor by copy.- Parameters:
rectangle
- the rectangle to copy.
-
-
Method Detail
-
setFromCorners
public void setFromCorners(double x1, double y1, double x2, double y2)
Description copied from interface:RectangularShape1afp
Change the frame of the rectangle conserving previous min and max if needed.- Specified by:
setFromCorners
in interfaceRectangularShape1afp<Shape1d<?>,Rectangle1d,Point1d,Vector1d,Segment1D<?,?>,Rectangle1d>
- 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.
-
getMinX
@Pure public double getMinX()
Description copied from interface:RectangularShape1afp
Replies the min X.- Specified by:
getMinX
in interfaceRectangularShape1afp<Shape1d<?>,Rectangle1d,Point1d,Vector1d,Segment1D<?,?>,Rectangle1d>
- Returns:
- the min x.
-
setMinX
public void setMinX(double x)
Description copied from interface:RectangularShape1afp
Set the min X conserving previous min if needed.- Specified by:
setMinX
in interfaceRectangularShape1afp<Shape1d<?>,Rectangle1d,Point1d,Vector1d,Segment1D<?,?>,Rectangle1d>
- Parameters:
x
- the min x.
-
getMaxX
@Pure public double getMaxX()
Description copied from interface:RectangularShape1afp
Replies the max x.- Specified by:
getMaxX
in interfaceRectangularShape1afp<Shape1d<?>,Rectangle1d,Point1d,Vector1d,Segment1D<?,?>,Rectangle1d>
- Returns:
- the max x.
-
setMaxX
public void setMaxX(double x)
Description copied from interface:RectangularShape1afp
Set the max X conserving previous max if needed.- Specified by:
setMaxX
in interfaceRectangularShape1afp<Shape1d<?>,Rectangle1d,Point1d,Vector1d,Segment1D<?,?>,Rectangle1d>
- Parameters:
x
- the max x.
-
getMinY
@Pure public double getMinY()
Description copied from interface:RectangularShape1afp
Replies the min y.- Specified by:
getMinY
in interfaceRectangularShape1afp<Shape1d<?>,Rectangle1d,Point1d,Vector1d,Segment1D<?,?>,Rectangle1d>
- Returns:
- the min y.
-
setMinY
public void setMinY(double y)
Description copied from interface:RectangularShape1afp
Set the min Y conserving previous min if needed.- Specified by:
setMinY
in interfaceRectangularShape1afp<Shape1d<?>,Rectangle1d,Point1d,Vector1d,Segment1D<?,?>,Rectangle1d>
- Parameters:
y
- the min y.
-
getMaxY
@Pure public double getMaxY()
Description copied from interface:RectangularShape1afp
Replies the max y.- Specified by:
getMaxY
in interfaceRectangularShape1afp<Shape1d<?>,Rectangle1d,Point1d,Vector1d,Segment1D<?,?>,Rectangle1d>
- Returns:
- the max y.
-
setMaxY
public void setMaxY(double y)
Description copied from interface:RectangularShape1afp
Set the max Y conserving previous max if needed.- Specified by:
setMaxY
in interfaceRectangularShape1afp<Shape1d<?>,Rectangle1d,Point1d,Vector1d,Segment1D<?,?>,Rectangle1d>
- Parameters:
y
- the max y.
-
hashCode
@Pure public int hashCode()
- Specified by:
hashCode
in classAbstractShape1d<Rectangle1d>
-
-