Class OrientedRectangle2d
- java.lang.Object
-
- org.arakhne.afc.math.geometry.d2.d.AbstractShape2d<OrientedRectangle2d>
-
- org.arakhne.afc.math.geometry.d2.d.OrientedRectangle2d
-
- All Implemented Interfaces:
Serializable
,Cloneable
,OrientedRectangle2afp<Shape2d<?>,OrientedRectangle2d,PathElement2d,Point2d,Vector2d,Rectangle2d>
,Parallelogram2afp<Shape2d<?>,OrientedRectangle2d,PathElement2d,Point2d,Vector2d,Rectangle2d>
,Shape2afp<Shape2d<?>,OrientedRectangle2d,PathElement2d,Point2d,Vector2d,Rectangle2d>
,Shape2d<OrientedRectangle2d>
,Shape2D<Shape2d<?>,OrientedRectangle2d,PathIterator2afp<PathElement2d>,Point2d,Vector2d,Rectangle2d>
,JsonableObject
public class OrientedRectangle2d extends AbstractShape2d<OrientedRectangle2d> implements OrientedRectangle2afp<Shape2d<?>,OrientedRectangle2d,PathElement2d,Point2d,Vector2d,Rectangle2d>
Oriented rectangle with 2 double precision floating-point numbers.- Since:
- 13.0
- Version:
- 17.0 2020-01-04 14:41:43
- Author:
- Stéphane GALLAND, Nicolas GAUD, Maxime Grolleau
- 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.OrientedRectangle2afp
OrientedRectangle2afp.AbstractOrientedRectanglePathIterator<T extends PathElement2afp>, OrientedRectangle2afp.OrientedRectanglePathIterator<T extends PathElement2afp>, OrientedRectangle2afp.ProjectionToOrientedRectangleLocalCoordinateSystemPathIterator<T extends PathElement2afp>, OrientedRectangle2afp.TransformedOrientedRectanglePathIterator<T extends PathElement2afp>
-
Nested classes/interfaces inherited from interface org.arakhne.afc.math.geometry.d2.afp.Parallelogram2afp
Parallelogram2afp.AbstractParallelogramPathIterator<T extends PathElement2afp>, Parallelogram2afp.ParallelogramPathIterator<T extends PathElement2afp>, Parallelogram2afp.ProjectionToParallelogramLocalCoordinateSystemPathIterator<T extends PathElement2afp>, Parallelogram2afp.TransformedParallelogramPathIterator<T extends PathElement2afp>
-
-
Constructor Summary
Constructors Constructor Description OrientedRectangle2d()
Create an empty oriented rectangle.OrientedRectangle2d(double centerX, double centerY, double axis1X, double axis1Y, double axis1Extent, double axis2Extent)
Construct an oriented rectangle.OrientedRectangle2d(Iterable<? extends Point2D<?,?>> pointCloud)
Construct an oriented rectangle from the given cloud of points.OrientedRectangle2d(OrientedRectangle2afp<?,?,?,?,?,?> obr)
Create an oriented rectangle from the given OBR.OrientedRectangle2d(Point2D<?,?>... pointCloud)
Construct an oriented rectangle from the given cloud of points.OrientedRectangle2d(Point2D<?,?> center, Vector2D<?,?> axis1, double axis1Extent, double axis2Extent)
Construct an oriented rectangle.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Point2d
getCenter()
Replies the center.double
getCenterX()
Replies the center x.double
getCenterY()
Replies the center y.Vector2d
getFirstAxis()
Replies the first axis of the oriented rectangle.double
getFirstAxisExtent()
Replies the demi-size of the rectangle along its first axis.double
getFirstAxisX()
Replies coordinate x of the first axis of the oriented rectangle.double
getFirstAxisY()
Replies coordinate y of the first axis of the oriented rectangle.Vector2d
getSecondAxis()
Replies the second axis of the oriented rectangle.double
getSecondAxisExtent()
Replies the demi-size of the rectangle along its second axis.double
getSecondAxisX()
Replies coordinate x of the second axis of the oriented rectangle.double
getSecondAxisY()
Replies coordinate y of the second axis of the oriented rectangle.int
hashCode()
void
set(double centerX, double centerY, double axis1x, double axis1y, double axis1Extent, double axis2Extent)
Set the oriented rectangle.void
setCenter(double cx, double cy)
Set the center.void
setCenterX(double cx)
Set the center's x.void
setCenterY(double cy)
Set the center's y.void
setFirstAxis(double x, double y, double extent)
Set the first axis of the rectangle.void
setFirstAxisExtent(double extent)
Change the demi-size of the rectangle along its first axis.void
setSecondAxis(double x, double y, double extent)
Set the second axis of the rectangle.void
setSecondAxisExtent(double extent)
Change the demi-size of the rectangle along its second axis.-
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.OrientedRectangle2afp
clear, contains, contains, equalsToShape, getClosestPointTo, getClosestPointTo, getClosestPointTo, getClosestPointTo, getClosestPointTo, getClosestPointTo, getClosestPointTo, getClosestPointTo, getClosestPointTo, getClosestPointTo, getDistanceL1, getDistanceLinf, getDistanceSquared, getFarthestPointTo, getPathIterator, intersects, intersects, intersects, intersects, intersects, intersects, intersects, intersects, intersects, intersects, rotate, set, set, set, setFromPointCloud, toBoundingBox, translate
-
Methods inherited from interface org.arakhne.afc.math.geometry.d2.afp.Parallelogram2afp
isCCW, isEmpty, set, setCenter, setFirstAxis, setFirstAxis, setFirstAxis, setFromPointCloud, setSecondAxis, setSecondAxis, setSecondAxis
-
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
-
OrientedRectangle2d
public OrientedRectangle2d()
Create an empty oriented rectangle.
-
OrientedRectangle2d
public OrientedRectangle2d(OrientedRectangle2afp<?,?,?,?,?,?> obr)
Create an oriented rectangle from the given OBR.- Parameters:
obr
- the oriented rectangle to copy.
-
OrientedRectangle2d
public OrientedRectangle2d(Iterable<? extends Point2D<?,?>> pointCloud)
Construct an oriented rectangle from the given cloud of points.- Parameters:
pointCloud
- - the cloud of points.
-
OrientedRectangle2d
public OrientedRectangle2d(Point2D<?,?>... pointCloud)
Construct an oriented rectangle from the given cloud of points.- Parameters:
pointCloud
- - the cloud of points.
-
OrientedRectangle2d
public OrientedRectangle2d(double centerX, double centerY, double axis1X, double axis1Y, double axis1Extent, double axis2Extent)
Construct an oriented rectangle.- Parameters:
centerX
- is the X coordinate of the OBR center.centerY
- is the Y coordinate of the OBR center.axis1X
- is the X coordinate of first axis of the OBR.axis1Y
- is the Y coordinate of first axis of the OBR.axis1Extent
- is the extent of the first axis.axis2Extent
- is the extent of the second axis.
-
OrientedRectangle2d
public OrientedRectangle2d(Point2D<?,?> center, Vector2D<?,?> axis1, double axis1Extent, double axis2Extent)
Construct an oriented rectangle.- Parameters:
center
- is the OBR center.axis1
- is the first axis of the OBR.axis1Extent
- is the extent of the first axis.axis2Extent
- is the extent of the second axis.
-
-
Method Detail
-
hashCode
@Pure public int hashCode()
- Specified by:
hashCode
in classAbstractShape2d<OrientedRectangle2d>
-
getCenter
@Pure public Point2d getCenter()
Description copied from interface:Parallelogram2afp
Replies the center.- Specified by:
getCenter
in interfaceParallelogram2afp<Shape2d<?>,OrientedRectangle2d,PathElement2d,Point2d,Vector2d,Rectangle2d>
- Returns:
- the center.
-
getCenterX
@Pure public double getCenterX()
Description copied from interface:Parallelogram2afp
Replies the center x.- Specified by:
getCenterX
in interfaceParallelogram2afp<Shape2d<?>,OrientedRectangle2d,PathElement2d,Point2d,Vector2d,Rectangle2d>
- Returns:
- the center x.
-
setCenterX
public void setCenterX(double cx)
Description copied from interface:Parallelogram2afp
Set the center's x.- Specified by:
setCenterX
in interfaceParallelogram2afp<Shape2d<?>,OrientedRectangle2d,PathElement2d,Point2d,Vector2d,Rectangle2d>
- Parameters:
cx
- the center x.
-
setCenterY
public void setCenterY(double cy)
Description copied from interface:Parallelogram2afp
Set the center's y.- Specified by:
setCenterY
in interfaceParallelogram2afp<Shape2d<?>,OrientedRectangle2d,PathElement2d,Point2d,Vector2d,Rectangle2d>
- Parameters:
cy
- the center y.
-
getCenterY
@Pure public double getCenterY()
Description copied from interface:Parallelogram2afp
Replies the center y.- Specified by:
getCenterY
in interfaceParallelogram2afp<Shape2d<?>,OrientedRectangle2d,PathElement2d,Point2d,Vector2d,Rectangle2d>
- Returns:
- the center y.
-
setCenter
public void setCenter(double cx, double cy)
Description copied from interface:Parallelogram2afp
Set the center.- Specified by:
setCenter
in interfaceParallelogram2afp<Shape2d<?>,OrientedRectangle2d,PathElement2d,Point2d,Vector2d,Rectangle2d>
- Parameters:
cx
- the center x.cy
- the center y.
-
getFirstAxis
@Pure public Vector2d getFirstAxis()
Description copied from interface:Parallelogram2afp
Replies the first axis of the oriented rectangle.- Specified by:
getFirstAxis
in interfaceParallelogram2afp<Shape2d<?>,OrientedRectangle2d,PathElement2d,Point2d,Vector2d,Rectangle2d>
- Returns:
- the unit vector of the first axis.
-
getFirstAxisX
@Pure public double getFirstAxisX()
Description copied from interface:Parallelogram2afp
Replies coordinate x of the first axis of the oriented rectangle.- Specified by:
getFirstAxisX
in interfaceParallelogram2afp<Shape2d<?>,OrientedRectangle2d,PathElement2d,Point2d,Vector2d,Rectangle2d>
- Returns:
- the coordinate x of the unit vector of the first axis.
-
getFirstAxisY
@Pure public double getFirstAxisY()
Description copied from interface:Parallelogram2afp
Replies coordinate y of the first axis of the oriented rectangle.- Specified by:
getFirstAxisY
in interfaceParallelogram2afp<Shape2d<?>,OrientedRectangle2d,PathElement2d,Point2d,Vector2d,Rectangle2d>
- Returns:
- the coordinate y of the unit vector of the first axis.
-
getSecondAxis
@Pure public Vector2d getSecondAxis()
Description copied from interface:Parallelogram2afp
Replies the second axis of the oriented rectangle.- Specified by:
getSecondAxis
in interfaceParallelogram2afp<Shape2d<?>,OrientedRectangle2d,PathElement2d,Point2d,Vector2d,Rectangle2d>
- Returns:
- the unit vector of the second axis.
-
getSecondAxisX
@Pure public double getSecondAxisX()
Description copied from interface:Parallelogram2afp
Replies coordinate x of the second axis of the oriented rectangle.- Specified by:
getSecondAxisX
in interfaceParallelogram2afp<Shape2d<?>,OrientedRectangle2d,PathElement2d,Point2d,Vector2d,Rectangle2d>
- Returns:
- the coordinate x of the unit vector of the second axis.
-
getSecondAxisY
@Pure public double getSecondAxisY()
Description copied from interface:Parallelogram2afp
Replies coordinate y of the second axis of the oriented rectangle.- Specified by:
getSecondAxisY
in interfaceParallelogram2afp<Shape2d<?>,OrientedRectangle2d,PathElement2d,Point2d,Vector2d,Rectangle2d>
- Returns:
- the coordinate y of the unit vector of the second axis.
-
getFirstAxisExtent
@Pure public double getFirstAxisExtent()
Description copied from interface:Parallelogram2afp
Replies the demi-size of the rectangle along its first axis.- Specified by:
getFirstAxisExtent
in interfaceParallelogram2afp<Shape2d<?>,OrientedRectangle2d,PathElement2d,Point2d,Vector2d,Rectangle2d>
- Returns:
- the extent along the first axis.
-
setFirstAxisExtent
public void setFirstAxisExtent(double extent)
Description copied from interface:Parallelogram2afp
Change the demi-size of the rectangle along its first axis.- Specified by:
setFirstAxisExtent
in interfaceParallelogram2afp<Shape2d<?>,OrientedRectangle2d,PathElement2d,Point2d,Vector2d,Rectangle2d>
- Parameters:
extent
- - the extent along the first axis.
-
getSecondAxisExtent
@Pure public double getSecondAxisExtent()
Description copied from interface:Parallelogram2afp
Replies the demi-size of the rectangle along its second axis.- Specified by:
getSecondAxisExtent
in interfaceParallelogram2afp<Shape2d<?>,OrientedRectangle2d,PathElement2d,Point2d,Vector2d,Rectangle2d>
- Returns:
- the extent along the second axis.
-
setSecondAxisExtent
public void setSecondAxisExtent(double extent)
Description copied from interface:Parallelogram2afp
Change the demi-size of the rectangle along its second axis.- Specified by:
setSecondAxisExtent
in interfaceParallelogram2afp<Shape2d<?>,OrientedRectangle2d,PathElement2d,Point2d,Vector2d,Rectangle2d>
- Parameters:
extent
- - the extent along the second axis.
-
setFirstAxis
public void setFirstAxis(double x, double y, double extent)
Description copied from interface:Parallelogram2afp
Set the first axis of the rectangle. The second axis is updated to be perpendicular to the new first axis.- Specified by:
setFirstAxis
in interfaceParallelogram2afp<Shape2d<?>,OrientedRectangle2d,PathElement2d,Point2d,Vector2d,Rectangle2d>
- Parameters:
x
- x coordinate of the first axis.y
- y coordinate of the first axis.extent
- the demi-size of th parallelogram along the first axis.
-
setSecondAxis
public void setSecondAxis(double x, double y, double extent)
Description copied from interface:Parallelogram2afp
Set the second axis of the rectangle. The first axis is updated to be perpendicular to the new second axis.- Specified by:
setSecondAxis
in interfaceParallelogram2afp<Shape2d<?>,OrientedRectangle2d,PathElement2d,Point2d,Vector2d,Rectangle2d>
- Parameters:
x
- x coordinate of the second axis.y
- y coordinate of the second axis.extent
- the demi-size of the parallelogram along the second axis.
-
set
public void set(double centerX, double centerY, double axis1x, double axis1y, double axis1Extent, double axis2Extent)
Description copied from interface:OrientedRectangle2afp
Set the oriented rectangle. The second axis is automatically computed.- Specified by:
set
in interfaceOrientedRectangle2afp<Shape2d<?>,OrientedRectangle2d,PathElement2d,Point2d,Vector2d,Rectangle2d>
- Parameters:
centerX
- is the X coordinate of the oriented rectangle center.centerY
- is the Y coordinate of the oriented rectangle center.axis1x
- is the X coordinate of first axis of the oriented rectangle.axis1y
- is the Y coordinate of first axis of the oriented rectangle.axis1Extent
- is the extent of the first axis.axis2Extent
- is the extent of the second axis.
-
-