- java.lang.Object
-
- org.arakhne.afc.math.geometry.AbstractGeomFactoryBase
-
- org.arakhne.afc.math.geometry.d2.AbstractGeomFactory2D<Vector2i,Point2i>
-
- org.arakhne.afc.math.geometry.d2.i.GeomFactory2i
-
- All Implemented Interfaces:
GeomFactory2ai<PathElement2i,Point2i,Vector2i,Rectangle2i>,GeomFactory2D<Vector2i,Point2i>,GeomFactoryBase
public class GeomFactory2i extends AbstractGeomFactory2D<Vector2i,Point2i> implements GeomFactory2ai<PathElement2i,Point2i,Vector2i,Rectangle2i>
Factory of geometrical elements.- Since:
- 13.0
- Version:
- 17.0 2020-01-04 14:41:43
- Author:
- Stéphane GALLAND
- Maven Group Id:
- org.arakhne.afc.core
- Maven Artifact Id:
- mathgeom
-
-
Field Summary
Fields Modifier and Type Field Description static GeomFactory2iSINGLETONThe singleton of the factory.
-
Constructor Summary
Constructors Constructor Description GeomFactory2i()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Point2iconvertToPoint(Point2D<?,?> point)Convert the given point if it is not of the right type.Point2iconvertToPoint(Vector2D<?,?> vector)Convert the given vector.Vector2iconvertToVector(Point2D<?,?> point)Convert the given point.Vector2iconvertToVector(Vector2D<?,?> vector)Convert the given vector.PathElement2inewArcPathElement(int startX, int startY, int targetX, int targetY, int radiusX, int radiusY, double xAxisRotation, boolean largeArcFlag, boolean sweepFlag)Create an arc-to path element to the given point by following an ellipse arc.Rectangle2inewBox()Create an empty bounding box.Rectangle2inewBox(int x, int y, int width, int height)Create a bounding box.PathElement2inewClosePathElement(int lastPointX, int lastPointy, int firstPointX, int firstPointY)Create a close path element.PathElement2inewCurvePathElement(int startX, int startY, int controlX, int controlY, int targetX, int targetY)Create a quadratic curve path element to the given point through the given control point.PathElement2inewCurvePathElement(int startX, int startY, int controlX1, int controlY1, int controlX2, int controlY2, int targetX, int targetY)Create a curve path element to the given point through the two given control points.PathElement2inewLinePathElement(int startX, int startY, int targetX, int targetY)Create a line-to path element to the given point.PathElement2inewMovePathElement(int x, int y)Create a move-to path element to the given point.MultiShape2i<?>newMultiShape()Create an empty bounding box.Path2inewPath(PathWindingRule rule)Create an empty path with the given winding rule.Point2inewPoint()Create a point.Point2inewPoint(double x, double y)Create a point.Point2inewPoint(int x, int y)Create a point.Segment2inewSegment(int x1, int y1, int x2, int y2)Create a segment.Vector2inewVector()Create a vector.Vector2inewVector(double x, double y)Create a vector.Vector2inewVector(int x, int y)Create a vector.-
Methods inherited from class org.arakhne.afc.math.geometry.AbstractGeomFactoryBase
getGlobalSplineApproximationRatio, getSplineApproximationRatio, setGlobalSplineApproximationRatio, setSplineApproximationRatio
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.arakhne.afc.math.geometry.d2.ai.GeomFactory2ai
convert
-
Methods inherited from interface org.arakhne.afc.math.geometry.GeomFactoryBase
getSplineApproximationRatio, setSplineApproximationRatio
-
-
-
-
Field Detail
-
SINGLETON
public static final GeomFactory2i SINGLETON
The singleton of the factory.
-
-
Method Detail
-
convertToPoint
public Point2i convertToPoint(Point2D<?,?> point)
Description copied from interface:GeomFactory2DConvert the given point if it is not of the right type.- Specified by:
convertToPointin interfaceGeomFactory2D<Vector2i,Point2i>- Parameters:
point- the point to convert.- Returns:
pif it is of typeP, or a copy ofp.
-
convertToPoint
public Point2i convertToPoint(Vector2D<?,?> vector)
Description copied from interface:GeomFactory2DConvert the given vector.- Specified by:
convertToPointin interfaceGeomFactory2D<Vector2i,Point2i>- Parameters:
vector- the vector to convert.- Returns:
- the point.
-
convertToVector
public Vector2i convertToVector(Point2D<?,?> point)
Description copied from interface:GeomFactory2DConvert the given point.- Specified by:
convertToVectorin interfaceGeomFactory2D<Vector2i,Point2i>- Parameters:
point- the point to convert.- Returns:
- the vector.
-
convertToVector
public Vector2i convertToVector(Vector2D<?,?> vector)
Description copied from interface:GeomFactory2DConvert the given vector.- Specified by:
convertToVectorin interfaceGeomFactory2D<Vector2i,Point2i>- Parameters:
vector- the vector to convert.- Returns:
- the vector.
-
newPoint
public Point2i newPoint(int x, int y)
Description copied from interface:GeomFactory2DCreate a point.- Specified by:
newPointin interfaceGeomFactory2D<Vector2i,Point2i>- Parameters:
x- x coordinate of the point.y- y coordinate of the point.- Returns:
- the point.
-
newPoint
public Point2i newPoint(double x, double y)
Description copied from interface:GeomFactory2DCreate a point.- Specified by:
newPointin interfaceGeomFactory2D<Vector2i,Point2i>- Parameters:
x- x coordinate of the point.y- y coordinate of the point.- Returns:
- the point.
-
newPoint
public Point2i newPoint()
Description copied from interface:GeomFactory2DCreate a point.- Specified by:
newPointin interfaceGeomFactory2D<Vector2i,Point2i>- Returns:
- the point.
-
newVector
public Vector2i newVector(int x, int y)
Description copied from interface:GeomFactory2DCreate a vector.- Specified by:
newVectorin interfaceGeomFactory2D<Vector2i,Point2i>- Parameters:
x- x coordinate of the vector.y- y coordinate of the vector.- Returns:
- the vector.
-
newVector
public Vector2i newVector(double x, double y)
Description copied from interface:GeomFactory2DCreate a vector.- Specified by:
newVectorin interfaceGeomFactory2D<Vector2i,Point2i>- Parameters:
x- x coordinate of the vector.y- y coordinate of the vector.- Returns:
- the vector.
-
newVector
public Vector2i newVector()
Description copied from interface:GeomFactory2DCreate a vector.- Specified by:
newVectorin interfaceGeomFactory2D<Vector2i,Point2i>- Returns:
- the vector.
-
newPath
public Path2i newPath(PathWindingRule rule)
Description copied from interface:GeomFactory2aiCreate an empty path with the given winding rule.- Specified by:
newPathin interfaceGeomFactory2ai<PathElement2i,Point2i,Vector2i,Rectangle2i>- Parameters:
rule- the rule.- Returns:
- the new path.
-
newBox
public Rectangle2i newBox()
Description copied from interface:GeomFactory2aiCreate an empty bounding box.- Specified by:
newBoxin interfaceGeomFactory2ai<PathElement2i,Point2i,Vector2i,Rectangle2i>- Returns:
- the box.
-
newBox
public Rectangle2i newBox(int x, int y, int width, int height)
Description copied from interface:GeomFactory2aiCreate a bounding box.- Specified by:
newBoxin interfaceGeomFactory2ai<PathElement2i,Point2i,Vector2i,Rectangle2i>- Parameters:
x- the x coordinate of the lower corner.y- the y coordinate of the lower corner.width- the width of the box.height- the height of the box.- Returns:
- the box.
-
newMovePathElement
public PathElement2i newMovePathElement(int x, int y)
Description copied from interface:GeomFactory2aiCreate a move-to path element to the given point.- Specified by:
newMovePathElementin interfaceGeomFactory2ai<PathElement2i,Point2i,Vector2i,Rectangle2i>- Parameters:
x- x coordinate of the target point.y- y coordinate of the target point.- Returns:
- the path element.
-
newLinePathElement
public PathElement2i newLinePathElement(int startX, int startY, int targetX, int targetY)
Description copied from interface:GeomFactory2aiCreate a line-to path element to the given point.- Specified by:
newLinePathElementin interfaceGeomFactory2ai<PathElement2i,Point2i,Vector2i,Rectangle2i>- Parameters:
startX- x coordinate of the start point.startY- y coordinate of the start point.targetX- x coordinate of the target point.targetY- y coordinate of the target point.- Returns:
- the path element.
-
newClosePathElement
public PathElement2i newClosePathElement(int lastPointX, int lastPointy, int firstPointX, int firstPointY)
Description copied from interface:GeomFactory2aiCreate a close path element.- Specified by:
newClosePathElementin interfaceGeomFactory2ai<PathElement2i,Point2i,Vector2i,Rectangle2i>- Parameters:
lastPointX- x coordinate of the last point on the pathlastPointy- y coordinate of the last point on the pathfirstPointX- x coordinate of the first point on the path.firstPointY- y coordinate of the first point on the path.- Returns:
- the path element.
-
newCurvePathElement
public PathElement2i newCurvePathElement(int startX, int startY, int controlX, int controlY, int targetX, int targetY)
Description copied from interface:GeomFactory2aiCreate a quadratic curve path element to the given point through the given control point.- Specified by:
newCurvePathElementin interfaceGeomFactory2ai<PathElement2i,Point2i,Vector2i,Rectangle2i>- Parameters:
startX- x coordinate of the start point.startY- y coordinate of the start point.controlX- x coordinate of the control point.controlY- y coordinate of the control point.targetX- x coordinate of the target point.targetY- y coordinate of the target point.- Returns:
- the path element.
-
newCurvePathElement
public PathElement2i newCurvePathElement(int startX, int startY, int controlX1, int controlY1, int controlX2, int controlY2, int targetX, int targetY)
Description copied from interface:GeomFactory2aiCreate a curve path element to the given point through the two given control points.- Specified by:
newCurvePathElementin interfaceGeomFactory2ai<PathElement2i,Point2i,Vector2i,Rectangle2i>- Parameters:
startX- x coordinate of the start point.startY- y coordinate of the start point.controlX1- x coordinate of the control point.controlY1- y coordinate of the control point.controlX2- x coordinate of the control point.controlY2- y coordinate of the control point.targetX- x coordinate of the target point.targetY- y coordinate of the target point.- Returns:
- the path element.
-
newArcPathElement
public PathElement2i newArcPathElement(int startX, int startY, int targetX, int targetY, int radiusX, int radiusY, double xAxisRotation, boolean largeArcFlag, boolean sweepFlag)
Description copied from interface:GeomFactory2aiCreate an arc-to path element to the given point by following an ellipse arc.- Specified by:
newArcPathElementin interfaceGeomFactory2ai<PathElement2i,Point2i,Vector2i,Rectangle2i>- Parameters:
startX- x coordinate of the start point.startY- y coordinate of the start point.targetX- x coordinate of the target point.targetY- y coordinate of the target point.radiusX- the X radius of the tilted ellipse.radiusY- the Y radius of the tilted ellipse.xAxisRotation- the angle of tilt of the ellipse.largeArcFlag-trueiff the path will sweep the long way around the ellipse.sweepFlag-trueiff the path will sweep clockwise around the ellipse.- Returns:
- the path element.
-
newSegment
public Segment2i newSegment(int x1, int y1, int x2, int y2)
Description copied from interface:GeomFactory2aiCreate a segment.- Specified by:
newSegmentin interfaceGeomFactory2ai<PathElement2i,Point2i,Vector2i,Rectangle2i>- Parameters:
x1- the x coordinate of the first point of the segment.y1- the y coordinate of the first point of the segment.x2- the x coordinate of the second point of the segment.y2- the y coordinate of the second point of the segment.- Returns:
- the new segment.
-
newMultiShape
public MultiShape2i<?> newMultiShape()
Description copied from interface:GeomFactory2aiCreate an empty bounding box.- Specified by:
newMultiShapein interfaceGeomFactory2ai<PathElement2i,Point2i,Vector2i,Rectangle2i>- Returns:
- the box.
-
-