- java.lang.Object
-
- org.arakhne.afc.math.geometry.d2.i.AbstractShape2i<Rectangle2i>
-
- org.arakhne.afc.math.geometry.d2.i.Rectangle2i
-
- All Implemented Interfaces:
Serializable
,Cloneable
,Rectangle2ai<Shape2i<?>,Rectangle2i,PathElement2i,Point2i,Vector2i,Rectangle2i>
,RectangularShape2ai<Shape2i<?>,Rectangle2i,PathElement2i,Point2i,Vector2i,Rectangle2i>
,Shape2ai<Shape2i<?>,Rectangle2i,PathElement2i,Point2i,Vector2i,Rectangle2i>
,Shape2i<Rectangle2i>
,Shape2D<Shape2i<?>,Rectangle2i,PathIterator2ai<PathElement2i>,Point2i,Vector2i,Rectangle2i>
,JsonableObject
public class Rectangle2i extends AbstractShape2i<Rectangle2i> implements Rectangle2ai<Shape2i<?>,Rectangle2i,PathElement2i,Point2i,Vector2i,Rectangle2i>
A rectangle with 2 integer 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.ai.Rectangle2ai
Rectangle2ai.RectanglePathIterator<E extends PathElement2ai>, Rectangle2ai.RectangleSideIterator<P extends Point2D<? super P,? super V>,V extends Vector2D<? super V,? super P>>, Rectangle2ai.Side, Rectangle2ai.TransformedRectanglePathIterator<E extends PathElement2ai>
-
-
Constructor Summary
Constructors Constructor Description Rectangle2i()
Construct an empty rectangle.Rectangle2i(int x, int y, int width, int height)
Construct a rectangle with the given minimum corner and sizes.Rectangle2i(Rectangle2i rectangle)
Constructor by copy.Rectangle2i(Point2D<?,?> min, Point2D<?,?> max)
Construct a rectangle with the given minimum and maximum corners.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getMaxX()
Replies the max x.int
getMaxY()
Replies the max y.int
getMinX()
Replies the min X.int
getMinY()
Replies the min y.int
hashCode()
void
setFromCorners(int x1, int y1, int x2, int y2)
Change the frame of the rectangle conserving previous min and max if needed.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.-
Methods inherited from class org.arakhne.afc.math.geometry.d2.i.AbstractShape2i
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.ai.Rectangle2ai
contains, contains, createIntersection, createUnion, equalsToShape, getClosestPointTo, getClosestPointTo, getClosestPointTo, getClosestPointTo, getClosestPointTo, getDistanceL1, getDistanceLinf, getDistanceSquared, getFarthestPointTo, getPathIterator, getPointIterator, getPointIterator, intersects, intersects, intersects, intersects, intersects, set, setIntersection, setUnion
-
Methods inherited from interface org.arakhne.afc.math.geometry.d2.ai.RectangularShape2ai
clear, getCenter, getCenterX, getCenterY, getHeight, getWidth, inflate, isEmpty, set, set, setFromCenter, setFromCenter, setFromCorners, setHeight, setWidth, toBoundingBox, translate
-
Methods inherited from interface org.arakhne.afc.math.geometry.d2.ai.Shape2ai
contains, contains, createTransformedShape, getClosestPointTo, getClosestPointTo, 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
-
Rectangle2i
public Rectangle2i()
Construct an empty rectangle.
-
Rectangle2i
public Rectangle2i(Point2D<?,?> min, Point2D<?,?> max)
Construct a rectangle with the given minimum and maximum corners.- Parameters:
min
- is the min corner of the rectangle.max
- is the max corner of the rectangle.
-
Rectangle2i
public Rectangle2i(int x, int y, int width, int height)
Construct a rectangle with the given minimum corner and sizes.- 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.
-
Rectangle2i
public Rectangle2i(Rectangle2i rectangle)
Constructor by copy.- Parameters:
rectangle
- the rectangle to copy.
-
-
Method Detail
-
setFromCorners
public void setFromCorners(int x1, int y1, int x2, int y2)
Description copied from interface:RectangularShape2ai
Change the frame of the rectangle conserving previous min and max if needed.- Specified by:
setFromCorners
in interfaceRectangularShape2ai<Shape2i<?>,Rectangle2i,PathElement2i,Point2i,Vector2i,Rectangle2i>
- 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 int getMinX()
Description copied from interface:RectangularShape2ai
Replies the min X.- Specified by:
getMinX
in interfaceRectangularShape2ai<Shape2i<?>,Rectangle2i,PathElement2i,Point2i,Vector2i,Rectangle2i>
- Returns:
- the min x.
-
setMinX
public void setMinX(int x)
Description copied from interface:RectangularShape2ai
Set the min X conserving previous min if needed.- Specified by:
setMinX
in interfaceRectangularShape2ai<Shape2i<?>,Rectangle2i,PathElement2i,Point2i,Vector2i,Rectangle2i>
- Parameters:
x
- the min x.
-
getMaxX
@Pure public int getMaxX()
Description copied from interface:RectangularShape2ai
Replies the max x.- Specified by:
getMaxX
in interfaceRectangularShape2ai<Shape2i<?>,Rectangle2i,PathElement2i,Point2i,Vector2i,Rectangle2i>
- Returns:
- the max x.
-
setMaxX
public void setMaxX(int x)
Description copied from interface:RectangularShape2ai
Set the max X conserving previous max if needed.- Specified by:
setMaxX
in interfaceRectangularShape2ai<Shape2i<?>,Rectangle2i,PathElement2i,Point2i,Vector2i,Rectangle2i>
- Parameters:
x
- the max x.
-
getMinY
@Pure public int getMinY()
Description copied from interface:RectangularShape2ai
Replies the min y.- Specified by:
getMinY
in interfaceRectangularShape2ai<Shape2i<?>,Rectangle2i,PathElement2i,Point2i,Vector2i,Rectangle2i>
- Returns:
- the min y.
-
setMinY
public void setMinY(int y)
Description copied from interface:RectangularShape2ai
Set the min Y conserving previous min if needed.- Specified by:
setMinY
in interfaceRectangularShape2ai<Shape2i<?>,Rectangle2i,PathElement2i,Point2i,Vector2i,Rectangle2i>
- Parameters:
y
- the min y.
-
getMaxY
@Pure public int getMaxY()
Description copied from interface:RectangularShape2ai
Replies the max y.- Specified by:
getMaxY
in interfaceRectangularShape2ai<Shape2i<?>,Rectangle2i,PathElement2i,Point2i,Vector2i,Rectangle2i>
- Returns:
- the max y.
-
setMaxY
public void setMaxY(int y)
Description copied from interface:RectangularShape2ai
Set the max Y conserving previous max if needed.- Specified by:
setMaxY
in interfaceRectangularShape2ai<Shape2i<?>,Rectangle2i,PathElement2i,Point2i,Vector2i,Rectangle2i>
- Parameters:
y
- the max y.
-
hashCode
@Pure public int hashCode()
- Specified by:
hashCode
in classAbstractShape2i<Rectangle2i>
-
-