Interface Path3D<ST extends Shape3D<?,?,I,P,V,B>,IT extends Shape3D<?,?,I,P,V,B>,I extends PathIterator3D<?>,P extends Point3D<? super P,? super V>,V extends Vector3D<? super V,? super P>,B extends Shape3D<?,?,I,P,V,B>>
-
- Type Parameters:
ST
- is the type of the general implementation.IT
- is the type of the implementation of this shape.I
- is the type of the iterator used to obtain the elements of the path.P
- is the type of the points.V
- is the type of the vectors.B
- is the type of the bounding boxes.
- All Superinterfaces:
Cloneable
,JsonableObject
,Serializable
,Shape3D<ST,IT,I,P,V,B>
public interface Path3D<ST extends Shape3D<?,?,I,P,V,B>,IT extends Shape3D<?,?,I,P,V,B>,I extends PathIterator3D<?>,P extends Point3D<? super P,? super V>,V extends Vector3D<? super V,? super P>,B extends Shape3D<?,?,I,P,V,B>> extends Shape3D<ST,IT,I,P,V,B>
3D Path.- Version:
- 17.0 2020-01-04 14:41:43
- Author:
- Thomas PIOTROWSKI, Stéphane GALLAND
- Maven Group Id:
- org.arakhne.afc.core
- Maven Artifact Id:
- mathgeom
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
Path3D.ArcType
Type of drawing to used when drawing an arc.
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description void
closePath()
Closes the current subpath by drawing a straight line back to the coordinates of the lastmoveTo
.boolean
containsControlPoint(Point3D<?,?> point)
Replies if the given points exists in the coordinates of this path.void
curveTo(Point3D<?,?> ctrl1, Point3D<?,?> ctrl2, Point3D<?,?> to)
Adds a curved segment, defined by three new points, to the path by drawing a Bézier curve that intersects both the current coordinates and the specified coordinates(x3,y3)
, using the specified points(x1,y1)
and(x2,y2)
as Bézier control points.P
getCurrentPoint()
Replies the last point in the path.default double
getLength()
Replies the total length of the path.double
getLengthSquared()
Replies the total squared length of the path.int
getPathElementCount()
Replies the number of path elements in this path.PathElementType
getPathElementTypeAt(int index)
Replies the type of the path element at the given position in this path.I
getPathIterator(double flatness)
Replies an iterator on the path elements.P
getPointAt(int index)
Replies the point at the given index.PathWindingRule
getWindingRule()
Replies the winding rule for the path.boolean
isCurved()
Replies the path contains a curve..boolean
isMultiParts()
Replies the path has multiple parts, i.e. multipleMOVE_TO
are inside.boolean
isPolygon()
Replies the path is composed only by oneMOVE_TO
, a sequence ofLINE_TO
orQUAD_TO
orCURVE_TO
, and a singleCLOSE
primitives.boolean
isPolyline()
Replies the path is composed only by oneMOVE_TO
, and a sequence ofLINE_TO
primitives.void
lineTo(Point3D<?,?> to)
Adds a point to the path by drawing a straight line from the current coordinates to the new specified coordinates specified in double precision.void
moveTo(Point3D<?,?> position)
Adds a point to the path by moving to the specified coordinates specified in double precision.void
quadTo(Point3D<?,?> ctrl, Point3D<?,?> to)
Adds a curved segment, defined by two new points, to the path by drawing a Quadratic curve that intersects both the current coordinates and the specified coordinates(x2,y2)
, using the specified point(x1,y1)
as a quadratic parametric control point.void
removeLast()
Remove the last action.void
setLastPoint(Point3D<?,?> point)
Change the coordinates of the last inserted point.void
setWindingRule(PathWindingRule rule)
Set the winding rule for the path.int
size()
Replies the number of points in the path.B
toBoundingBoxWithCtrlPoints()
Replies the bounding box of all the points added in this path.void
toBoundingBoxWithCtrlPoints(B box)
Compute the bounding box of all the points added in this path.Collection<P>
toCollection()
Replies the collection that is contains all the points of the path.default double[]
toDoubleArray()
Replies the coordinates of this path in an array of double precision floating-point numbers.double[]
toDoubleArray(Transform3D transform)
Replies the coordinates of this path in an array of double precision floating-point numbers.default float[]
toFloatArray()
Replies the coordinates of this path in an array of single precision floating-point numbers.float[]
toFloatArray(Transform3D transform)
Replies the coordinates of this path in an array of single precision floating-point numbers.default int[]
toIntArray()
Replies the coordinates of this path in an array of integer numbers.int[]
toIntArray(Transform3D transform)
Replies the coordinates of this path in an array of integer numbers.default P[]
toPointArray()
Replies the points of this path in an array.P[]
toPointArray(Transform3D transform)
Replies the points of this path in an array.-
Methods inherited from interface org.arakhne.afc.vmutil.json.JsonableObject
toJson
-
Methods inherited from interface org.arakhne.afc.math.geometry.d3.Shape3D
clear, clone, contains, contains, createTransformedShape, equalsToPathIterator, equalsToShape, getClosestPointTo, getClosestPointTo, getDistance, getDistance, getDistanceL1, getDistanceLinf, getDistanceSquared, getDistanceSquared, getFarthestPointTo, getGeomFactory, getPathIterator, getPathIterator, intersects, isEmpty, operator_add, operator_and, operator_and, operator_minus, operator_multiply, operator_plus, operator_remove, operator_upTo, set, toBoundingBox, toBoundingBox, translate
-
-
-
-
Method Detail
-
getWindingRule
@Pure PathWindingRule getWindingRule()
Replies the winding rule for the path.- Returns:
- the winding rule for the path.
-
setWindingRule
void setWindingRule(PathWindingRule rule)
Set the winding rule for the path.- Parameters:
rule
- is the winding rule for the path.
-
isPolyline
@Pure boolean isPolyline()
Replies the path is composed only by oneMOVE_TO
, and a sequence ofLINE_TO
primitives.- Returns:
true
if the path does not contain curve primitives,false
otherwise.
-
isCurved
@Pure boolean isCurved()
Replies the path contains a curve..- Returns:
true
if the path does not contain curve primitives,false
otherwise.
-
isMultiParts
@Pure boolean isMultiParts()
Replies the path has multiple parts, i.e. multipleMOVE_TO
are inside. primitives.- Returns:
true
if the path has multiple move-to primitive,false
otherwise.
-
isPolygon
@Pure boolean isPolygon()
Replies the path is composed only by oneMOVE_TO
, a sequence ofLINE_TO
orQUAD_TO
orCURVE_TO
, and a singleCLOSE
primitives.- Returns:
true
if the path does not contain curve primitives,false
otherwise.
-
getPathIterator
@Pure I getPathIterator(double flatness)
Replies an iterator on the path elements.Only
PathElementType.MOVE_TO
,PathElementType.LINE_TO
, andPathElementType.CLOSE
types are returned by the iterator.The amount of subdivision of the curved segments is controlled by the flatness parameter, which specifies the maximum distance that any point on the unflattened transformed curve can deviate from the returned flattened path segments. Note that a limit on the accuracy of the flattened path might be silently imposed, causing very small flattening parameters to be treated as larger values. This limit, if there is one, is defined by the particular implementation that is used.
The iterator for this class is not multi-threaded safe.
- Parameters:
flatness
- is the maximum distance that the line segments used to approximate the curved segments are allowed to deviate from any point on the original curve.- Returns:
- an iterator on the path elements.
-
moveTo
void moveTo(Point3D<?,?> position)
Adds a point to the path by moving to the specified coordinates specified in double precision.- Parameters:
position
- the new position.
-
lineTo
void lineTo(Point3D<?,?> to)
Adds a point to the path by drawing a straight line from the current coordinates to the new specified coordinates specified in double precision.- Parameters:
to
- the end point
-
quadTo
void quadTo(Point3D<?,?> ctrl, Point3D<?,?> to)
Adds a curved segment, defined by two new points, to the path by drawing a Quadratic curve that intersects both the current coordinates and the specified coordinates(x2,y2)
, using the specified point(x1,y1)
as a quadratic parametric control point. All coordinates are specified in double precision.- Parameters:
ctrl
- the quadratic control pointto
- the final end point
-
curveTo
void curveTo(Point3D<?,?> ctrl1, Point3D<?,?> ctrl2, Point3D<?,?> to)
Adds a curved segment, defined by three new points, to the path by drawing a Bézier curve that intersects both the current coordinates and the specified coordinates(x3,y3)
, using the specified points(x1,y1)
and(x2,y2)
as Bézier control points. All coordinates are specified in double precision.- Parameters:
ctrl1
- the first Bézier control pointctrl2
- the second Bézier control pointto
- the final end point
-
closePath
void closePath()
Closes the current subpath by drawing a straight line back to the coordinates of the lastmoveTo
. If the path is already closed or if the previous coordinates are for amoveTo
then this method has no effect.
-
toBoundingBoxWithCtrlPoints
B toBoundingBoxWithCtrlPoints()
Replies the bounding box of all the points added in this path.The replied bounding box includes the (invisible) control points.
- Returns:
- the bounding box with the control points.
- See Also:
Shape3D.toBoundingBox()
-
toBoundingBoxWithCtrlPoints
void toBoundingBoxWithCtrlPoints(B box)
Compute the bounding box of all the points added in this path.The replied bounding box includes the (invisible) control points.
- Parameters:
box
- is the rectangle to set with the bounds.- See Also:
Shape3D.toBoundingBox()
-
toIntArray
@Pure default int[] toIntArray()
Replies the coordinates of this path in an array of integer numbers.- Returns:
- the coordinates.
-
toIntArray
@Pure int[] toIntArray(Transform3D transform)
Replies the coordinates of this path in an array of integer numbers.- Parameters:
transform
- is the transformation to apply to all the coordinates.- Returns:
- the coordinates.
-
toFloatArray
@Pure default float[] toFloatArray()
Replies the coordinates of this path in an array of single precision floating-point numbers.- Returns:
- the coordinates.
-
toFloatArray
@Pure float[] toFloatArray(Transform3D transform)
Replies the coordinates of this path in an array of single precision floating-point numbers.- Parameters:
transform
- is the transformation to apply to all the coordinates.- Returns:
- the coordinates.
-
toDoubleArray
@Pure default double[] toDoubleArray()
Replies the coordinates of this path in an array of double precision floating-point numbers.- Returns:
- the coordinates.
-
toDoubleArray
@Pure double[] toDoubleArray(Transform3D transform)
Replies the coordinates of this path in an array of double precision floating-point numbers.- Parameters:
transform
- is the transformation to apply to all the coordinates.- Returns:
- the coordinates.
-
toPointArray
@Pure default P[] toPointArray()
Replies the points of this path in an array.- Returns:
- the points.
-
toPointArray
@Pure P[] toPointArray(Transform3D transform)
Replies the points of this path in an array.- Parameters:
transform
- is the transformation to apply to all the points.- Returns:
- the points.
-
toCollection
@Pure Collection<P> toCollection()
Replies the collection that is contains all the points of the path.- Returns:
- the point collection.
-
getPointAt
@Pure P getPointAt(int index)
Replies the point at the given index. The index is in [0;size()
).- Parameters:
index
- the index.- Returns:
- the point at the given index.
-
getCurrentPoint
@Pure P getCurrentPoint()
Replies the last point in the path.- Returns:
- the last point.
-
size
@Pure int size()
Replies the number of points in the path.- Returns:
- the number of points in the path.
-
getPathElementCount
@Pure int getPathElementCount()
Replies the number of path elements in this path.- Returns:
- the number of path elements.
- See Also:
getPathElementTypeAt(int)
-
getPathElementTypeAt
@Pure PathElementType getPathElementTypeAt(int index)
Replies the type of the path element at the given position in this path.- Parameters:
index
- the index of the path element.- Returns:
- the type of the path element.
- See Also:
getPathElementCount()
-
getLength
@Pure default double getLength()
Replies the total length of the path.- Returns:
- the length of the path.
-
getLengthSquared
@Pure double getLengthSquared()
Replies the total squared length of the path.- Returns:
- the length of the path.
-
removeLast
void removeLast()
Remove the last action.
-
setLastPoint
void setLastPoint(Point3D<?,?> point)
Change the coordinates of the last inserted point.- Parameters:
point
- the point.
-
containsControlPoint
@Pure boolean containsControlPoint(Point3D<?,?> point)
Replies if the given points exists in the coordinates of this path.- Parameters:
point
- the point.- Returns:
true
if the point is a control point of the path.
-
-