Interface Path3ai<ST extends Shape3ai<?,?,IE,P,V,B>,IT extends Path3ai<?,?,IE,P,V,B>,IE extends PathElement3ai,P extends Point3D<? super P,? super V>,V extends Vector3D<? super V,? super P>,B extends RectangularPrism3ai<?,?,IE,P,V,B>>
-
- Type Parameters:
ST
- is the type of the general implementation.IT
- is the type of the implementation of this shape.IE
- is the type of the path elements.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
,Path3D<ST,IT,PathIterator3ai<IE>,P,V,B>
,Serializable
,Shape3ai<ST,IT,IE,P,V,B>
,Shape3D<ST,IT,PathIterator3ai<IE>,P,V,B>
public interface Path3ai<ST extends Shape3ai<?,?,IE,P,V,B>,IT extends Path3ai<?,?,IE,P,V,B>,IE extends PathElement3ai,P extends Point3D<? super P,? super V>,V extends Vector3D<? super V,? super P>,B extends RectangularPrism3ai<?,?,IE,P,V,B>> extends Shape3ai<ST,IT,IE,P,V,B>, Path3D<ST,IT,PathIterator3ai<IE>,P,V,B>
Fonctional interface that represented a 2D path on a plane.- Since:
- 13.0
- Version:
- 17.0 2020-01-04 14:41:43
- Author:
- Stéphane GALLAND, Hamza JAFFALI
- Maven Group Id:
- org.arakhne.afc.core
- Maven Artifact Id:
- mathgeom
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
Path3ai.AbstractPathIterator<E extends PathElement3ai>
An abstract path iterator.static class
Path3ai.FlatteningPathIterator<E extends PathElement3ai>
A path iterator that is flattening the path.static class
Path3ai.PathPathIterator<E extends PathElement3ai>
A path iterator that does not transform the coordinates.static class
Path3ai.PixelIterator<P extends Point3D<? super P,? super V>,V extends Vector3D<? super V,? super P>>
Iterator on the pixels of the path.static class
Path3ai.PointCollection<P extends Point3D<? super P,? super V>,V extends Vector3D<? super V,? super P>>
An collection of the points of the path.static class
Path3ai.PointIterator<P extends Point3D<? super P,? super V>,V extends Vector3D<? super V,? super P>>
Iterator on the points of the path.static class
Path3ai.PrivateAPI
Private API for Path3ai.static class
Path3ai.TransformedPathIterator<E extends PathElement3ai>
A path iterator that transforms the coordinates.-
Nested classes/interfaces inherited from interface org.arakhne.afc.math.geometry.d3.Path3D
Path3D.ArcType
-
-
Field Summary
Fields Modifier and Type Field Description static int
DEFAULT_FLATTENING_LIMIT
Default depth for the flattening of the path.static PathWindingRule
DEFAULT_WINDING_RULE
The default winding rule:PathWindingRule.NON_ZERO
.static int
GROW_SIZE
Multiple of cubic & quad curve size.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default void
add(Iterator<? extends PathElement3ai> iterator)
Add the elements replied by the iterator into this path.static boolean
computeControlPointBoundingBox(PathIterator3ai<?> iterator, RectangularPrism3ai<?,?,?,?,?,?> box)
Compute the box that corresponds to the control points of the path.static int
computeCrossingsFromPath(int crossings, PathIterator3ai<?> iterator, BasicPathShadow3ai shadow, CrossingComputationType type)
Accumulate the number of times the path crosses the shadow extending to the right of the second path.static int
computeCrossingsFromPoint(int crossings, PathIterator3ai<?> pi, int px, int py, int pz, CrossingComputationType type)
Calculates the number of times the given path crosses the ray extending to the right from (px,py).static int
computeCrossingsFromRect(int crossings, PathIterator3ai<?> pi, int rxmin, int rymin, int rzmin, int rxmax, int rymax, int rzmax, CrossingComputationType type)
Accumulate the number of times the path crosses the shadow extending to the right of the rectangle.static int
computeCrossingsFromSegment(int crossings, PathIterator3ai<?> pi, int x1, int y1, int z1, int x2, int y2, int z2, CrossingComputationType type)
Calculates the number of times the given path crosses the given circle extending to the right.static int
computeCrossingsFromSphere(int crossings, PathIterator3ai<?> pi, int cx, int cy, int cz, int radius, CrossingComputationType type)
Calculates the number of times the given path crosses the given circle extending to the right.static boolean
computeDrawableElementBoundingBox(PathIterator3ai<?> iterator, RectangularPrism3ai<?,?,?,?,?,?> box)
Compute the box that corresponds to the drawable elements of the path.default boolean
contains(int x, int y, int z)
Replies if the given point is inside this shape.static boolean
contains(PathIterator3ai<?> pi, int x, int y, int z)
Tests if the specified coordinates are inside the closed boundary of the specifiedPathIterator3ai
.static boolean
contains(PathIterator3ai<?> pi, int rx, int ry, int rz, int rwidth, int rheight, int rdepth)
Tests if the specified rectangle is inside the closed boundary of the specifiedPathIterator3ai
.default boolean
contains(RectangularPrism3ai<?,?,?,?,?,?> box)
Replies if the given rectangle is inside this shape.void
curveTo(int x1, int y1, int z1, int x2, int y2, int z2, int x3, int y3, int z3)
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.default 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.default boolean
equalsToShape(IT shape)
Replies this shape is equal to the given shape.default P
getClosestPointTo(MultiShape3ai<?,?,?,?,?,?,?> multishape)
Replies the closest point on this shape to the given rectangle.default P
getClosestPointTo(Path3ai<?,?,?,?,?,?> path)
Replies the closest point on this shape to the given rectangle.static void
getClosestPointTo(PathIterator3ai<? extends PathElement3ai> pi, int x, int y, int z, Point3D<?,?> result)
Replies the point on the path that is closest to the given point.default P
getClosestPointTo(RectangularPrism3ai<?,?,?,?,?,?> rectangle)
Replies the closest point on this shape to the given rectangle.default P
getClosestPointTo(Segment3ai<?,?,?,?,?,?> segment)
Replies the closest point on this shape to the given rectangle.default P
getClosestPointTo(Sphere3ai<?,?,?,?,?,?> circle)
Replies the closest point on this shape to the given rectangle.default P
getClosestPointTo(Point3D<?,?> pt)
Replies the point on the shape that is closest to the given point.int
getCoordAt(int index)
Replies the coordinate at the given index.default P
getCurrentPoint()
Replies the last point in the path.int
getCurrentX()
Replies the x coordinate of the last point in the path.int
getCurrentY()
Replies the x coordinate of the last point in the path.int
getCurrentZ()
Replies the z coordinate of the last point in the path.default double
getDistanceL1(Point3D<?,?> point)
Computes the L-1 (Manhattan) distance between this shape and point p1.default double
getDistanceLinf(Point3D<?,?> point)
Computes the L-infinite distance between this shape and point p1.default double
getDistanceSquared(Point3D<?,?> point)
Replies the squared value of the minimal distance from this shape to the given point.static void
getFarthestPointTo(PathIterator3ai<? extends PathElement3ai> pi, int x, int y, int z, Point3D<?,?> result)
Replies the point on the path that is farthest to the given point.default P
getFarthestPointTo(Point3D<?,?> pt)
Replies the point on the shape that is farthest the given point.default double
getLengthSquared()
Replies the total squared length of the path.default PathIterator3ai<IE>
getPathIterator(double flatness)
Replies an iterator on the path elements.default PathIterator3ai<IE>
getPathIterator(Transform3D transform)
Replies the elements of the paths.default Iterator<P>
getPointIterator()
Replies an iterator on the points covered by the perimeter of this shape.default boolean
intersects(MultiShape3ai<?,?,?,?,?,?,?> multishape)
Replies if this shape is intersecting the given multishape.default boolean
intersects(PathIterator3ai<?> iterator)
Replies if this shape is intersecting the path described by the given iterator.static boolean
intersects(PathIterator3ai<?> pi, int x, int y, int z, int width, int height, int depth)
Tests if the interior of the specifiedPathIterator3ai
intersects the interior of a specified set of rectangular coordinates.default boolean
intersects(RectangularPrism3ai<?,?,?,?,?,?> rectangularPrism)
Replies if this shape is intersecting the given rectangular prism.default boolean
intersects(Segment3ai<?,?,?,?,?,?> segment)
Replies if this shape is intersecting the given segment.default boolean
intersects(Sphere3ai<?,?,?,?,?,?> sphere)
Replies if this shape is intersecting the given sphere.void
lineTo(int x, int y, int z)
Adds a point to the path by drawing a straight line from the current coordinates to the new specified coordinates specified in double precision.default 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(int x, int y, int z)
Adds a point to the path by moving to the specified coordinates specified in double precision.default void
moveTo(Point3D<?,?> position)
Adds a point to the path by moving to the specified coordinates specified in double precision.void
quadTo(int x1, int y1, int z1, int x2, int y2, int z2)
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.default 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.boolean
remove(int x, int y, int z)
Remove the point with the given coordinates.default void
set(Path3ai<?,?,?,?,?,?> path)
Set the path.void
setLastPoint(int x, int y, int z)
Change the coordinates of the last inserted point.default void
setLastPoint(Point3D<?,?> point)
Change the coordinates of the last inserted point.default Collection<P>
toCollection()
Replies the collection that is contains all the points of the path.void
transform(Transform3D transform)
Transform the current path.-
Methods inherited from interface org.arakhne.afc.vmutil.json.JsonableObject
toJson
-
Methods inherited from interface org.arakhne.afc.math.geometry.d3.Path3D
closePath, containsControlPoint, getLength, getPathElementCount, getPathElementTypeAt, getPointAt, getWindingRule, isCurved, isMultiParts, isPolygon, isPolyline, removeLast, setWindingRule, size, toBoundingBoxWithCtrlPoints, toBoundingBoxWithCtrlPoints, toDoubleArray, toDoubleArray, toFloatArray, toFloatArray, toIntArray, toIntArray, toPointArray, toPointArray
-
Methods inherited from interface org.arakhne.afc.math.geometry.d3.ai.Shape3ai
contains, contains, createTransformedShape, getClosestPointTo, getDistanceSquared, getDistanceSquared, getDistanceSquared, getDistanceSquared, getDistanceSquared, getDistanceSquared, getGeomFactory, intersects, intersects, toBoundingBox, translate, translate
-
Methods inherited from interface org.arakhne.afc.math.geometry.d3.Shape3D
clear, clone, equalsToPathIterator, getDistance, getDistance, getPathIterator, isEmpty, operator_add, operator_and, operator_and, operator_minus, operator_multiply, operator_plus, operator_remove, operator_upTo, set, toBoundingBox
-
-
-
-
Field Detail
-
GROW_SIZE
static final int GROW_SIZE
Multiple of cubic & quad curve size.- See Also:
- Constant Field Values
-
DEFAULT_FLATTENING_LIMIT
static final int DEFAULT_FLATTENING_LIMIT
Default depth for the flattening of the path.- See Also:
- Constant Field Values
-
DEFAULT_WINDING_RULE
static final PathWindingRule DEFAULT_WINDING_RULE
The default winding rule:PathWindingRule.NON_ZERO
.
-
-
Method Detail
-
computeDrawableElementBoundingBox
static boolean computeDrawableElementBoundingBox(PathIterator3ai<?> iterator, RectangularPrism3ai<?,?,?,?,?,?> box)
Compute the box that corresponds to the drawable elements of the path.An element is drawable if it is a line, a curve, or a closing path element.
- Parameters:
iterator
- the iterator on the path elements.box
- the box to set.- Returns:
true
if a drawable element was found.
-
computeControlPointBoundingBox
static boolean computeControlPointBoundingBox(PathIterator3ai<?> iterator, RectangularPrism3ai<?,?,?,?,?,?> box)
Compute the box that corresponds to the control points of the path.An element is drawable if it is a line, a curve, or a closing path element. The box fits the drawn lines and the drawn curves. The control points of the curves may be outside the output box. For obtaining the bounding box of the drawn lines and cruves, use
computeDrawableElementBoundingBox(PathIterator3ai, RectangularPrism3ai)
.- Parameters:
iterator
- the iterator on the path elements.box
- the box to set.- Returns:
true
if a control point was found.- See Also:
computeDrawableElementBoundingBox(PathIterator3ai, RectangularPrism3ai)
-
computeCrossingsFromSegment
static int computeCrossingsFromSegment(int crossings, PathIterator3ai<?> pi, int x1, int y1, int z1, int x2, int y2, int z2, CrossingComputationType type)
Calculates the number of times the given path crosses the given circle extending to the right.- Parameters:
crossings
- is the initial value for crossing.pi
- is the description of the path.x1
- is the first point of the segment.y1
- is the first point of the segment.z1
- is the first point of the segment.x2
- is the first point of the segment.y2
- is the first point of the segment.z2
- is the first point of the segment.type
- is the type of special computation to apply. Ifnull
, it is equivalent toCrossingComputationType.STANDARD
.- Returns:
- the crossing
-
computeCrossingsFromSphere
static int computeCrossingsFromSphere(int crossings, PathIterator3ai<?> pi, int cx, int cy, int cz, int radius, CrossingComputationType type)
Calculates the number of times the given path crosses the given circle extending to the right.- Parameters:
crossings
- is the initial value for crossing.pi
- is the description of the path.cx
- is the center of the circle.cy
- is the center of the circle.cz
- is the center of the circle.radius
- is the radius of the circle.type
- is the type of special computation to apply. Ifnull
, it is equivalent toCrossingComputationType.STANDARD
.- Returns:
- the crossing
-
computeCrossingsFromPoint
static int computeCrossingsFromPoint(int crossings, PathIterator3ai<?> pi, int px, int py, int pz, CrossingComputationType type)
Calculates the number of times the given path crosses the ray extending to the right from (px,py). If the point lies on a part of the path, then no crossings are counted for that intersection. +1 is added for each crossing where the Y coordinate is increasing -1 is added for each crossing where the Y coordinate is decreasing The return value is the sum of all crossings for every segment in the path. The path must start with a MOVE_TO, otherwise an exception is thrown.- Parameters:
crossings
- the initial crossing.pi
- is the description of the path.px
- is the reference point to test.py
- is the reference point to test.pz
- is the reference point to test.type
- is the type of special computation to apply. Ifnull
, it is equivalent toCrossingComputationType.STANDARD
.- Returns:
- the crossing, or
GeomConstants.SHAPE_INTERSECTS
-
computeCrossingsFromPath
static int computeCrossingsFromPath(int crossings, PathIterator3ai<?> iterator, BasicPathShadow3ai shadow, CrossingComputationType type)
Accumulate the number of times the path crosses the shadow extending to the right of the second path. See the comment for the SHAPE_INTERSECTS constant for more complete details. The return value is the sum of all crossings for both the top and bottom of the shadow for every segment in the path, or the special value SHAPE_INTERSECTS if the path ever enters the interior of the rectangle. The path must start with a SEG_MOVETO, otherwise an exception is thrown. The caller must check r[xy]{min,max} for NaN values.- Parameters:
crossings
- the intial crossing.iterator
- is the iterator on the path elements.shadow
- is the description of the shape to project to the right.type
- is the type of special computation to apply. Ifnull
, it is equivalent toCrossingComputationType.STANDARD
.- Returns:
- the crossings.
- See Also:
- "WeilerâAtherton clipping algorithm"
-
contains
static boolean contains(PathIterator3ai<?> pi, int x, int y, int z)
Tests if the specified coordinates are inside the closed boundary of the specifiedPathIterator3ai
.This method provides a basic facility for implementors of the
Shape3ai
interface to implement support for theShape3ai.contains(int, int, int)
method.- Parameters:
pi
- the specifiedPathIterator2f
x
- the specified X coordinatey
- the specified Y coordinatez
- the specified Z coordinate- Returns:
true
if the specified coordinates are inside the specifiedPathIterator2f
;false
otherwise
-
contains
static boolean contains(PathIterator3ai<?> pi, int rx, int ry, int rz, int rwidth, int rheight, int rdepth)
Tests if the specified rectangle is inside the closed boundary of the specifiedPathIterator3ai
.The points on the path are assumed to be outside the path area. It means that is the rectangle is intersecting the path, this function replies
false
.- Parameters:
pi
- the specifiedPathIterator3ai
rx
- the lowest corner of the rectangle.ry
- the lowest corner of the rectangle.rz
- the lowest corner of the rectangle.rwidth
- is the width of the rectangle.rheight
- is the width of the rectangle.rdepth
- is the width of the rectangle.- Returns:
true
if the specified rectangle is inside the specifiedPathIterator2f
;false
otherwise.
-
contains
@Pure default boolean contains(RectangularPrism3ai<?,?,?,?,?,?> box)
Description copied from interface:Shape3ai
Replies if the given rectangle is inside this shape.- Specified by:
contains
in interfaceShape3ai<ST extends Shape3ai<?,?,IE,P,V,B>,IT extends Path3ai<?,?,IE,P,V,B>,IE extends PathElement3ai,P extends Point3D<? super P,? super V>,V extends Vector3D<? super V,? super P>,B extends RectangularPrism3ai<?,?,IE,P,V,B>>
- Parameters:
box
- the rectangle to test.- Returns:
true
if the given box is inside the shape.
-
contains
default boolean contains(int x, int y, int z)
Description copied from interface:Shape3ai
Replies if the given point is inside this shape.- Specified by:
contains
in interfaceShape3ai<ST extends Shape3ai<?,?,IE,P,V,B>,IT extends Path3ai<?,?,IE,P,V,B>,IE extends PathElement3ai,P extends Point3D<? super P,? super V>,V extends Vector3D<? super V,? super P>,B extends RectangularPrism3ai<?,?,IE,P,V,B>>
- Parameters:
x
- x coordinate of the point to test.y
- y coordinate of the point to test.z
- z coordinate of the point to test.- Returns:
true
if the given point is inside this shape, otherwisefalse
.
-
computeCrossingsFromRect
static int computeCrossingsFromRect(int crossings, PathIterator3ai<?> pi, int rxmin, int rymin, int rzmin, int rxmax, int rymax, int rzmax, CrossingComputationType type)
Accumulate the number of times the path crosses the shadow extending to the right of the rectangle. See the comment for the SHAPE_INTERSECTS constant for more complete details. The return value is the sum of all crossings for both the top and bottom of the shadow for every segment in the path, or the special value SHAPE_INTERSECTS if the path ever enters the interior of the rectangle. The path must start with a SEG_MOVETO, otherwise an exception is thrown. The caller must check r[xy]{min,max} for NaN values.- Parameters:
crossings
- the initial crossing.pi
- is the iterator on the path elements.rxmin
- is the first corner of the rectangle.rymin
- is the first corner of the rectangle.rzmin
- is the first corner of the rectangle.rxmax
- is the second corner of the rectangle.rymax
- is the second corner of the rectangle.rzmax
- is the second corner of the rectangle.type
- is the type of special computation to apply. Ifnull
, it is equivalent toCrossingComputationType.STANDARD
.- Returns:
- the crossings.
-
intersects
static boolean intersects(PathIterator3ai<?> pi, int x, int y, int z, int width, int height, int depth)
Tests if the interior of the specifiedPathIterator3ai
intersects the interior of a specified set of rectangular coordinates.This method provides a basic facility for implementors of the
Shape3ai
interface to implement support for theintersects()
method.This method object may conservatively return true in cases where the specified rectangular area intersects a segment of the path, but that segment does not represent a boundary between the interior and exterior of the path. Such a case may occur if some set of segments of the path are retraced in the reverse direction such that the two sets of segments cancel each other out without any interior area between them. To determine whether segments represent true boundaries of the interior of the path would require extensive calculations involving all of the segments of the path and the winding rule and are thus beyond the scope of this implementation.
- Parameters:
pi
- the specifiedPathIterator
x
- the specified X coordinatey
- the specified Y coordinatez
- the specified Z coordinatewidth
- the width of the specified rectangular coordinatesheight
- the height of the specified rectangular coordinatesdepth
- the depth of the specified rectangular coordinates- Returns:
true
if the specifiedPathIterator
and the interior of the specified set of rectangular coordinates intersect each other;false
otherwise.
-
intersects
@Pure default boolean intersects(Sphere3ai<?,?,?,?,?,?> sphere)
Description copied from interface:Shape3ai
Replies if this shape is intersecting the given sphere.- Specified by:
intersects
in interfaceShape3ai<ST extends Shape3ai<?,?,IE,P,V,B>,IT extends Path3ai<?,?,IE,P,V,B>,IE extends PathElement3ai,P extends Point3D<? super P,? super V>,V extends Vector3D<? super V,? super P>,B extends RectangularPrism3ai<?,?,IE,P,V,B>>
- Parameters:
sphere
- the sphere- Returns:
true
if this shape is intersecting the given shape;false
if there is no intersection.
-
intersects
@Pure default boolean intersects(RectangularPrism3ai<?,?,?,?,?,?> rectangularPrism)
Description copied from interface:Shape3ai
Replies if this shape is intersecting the given rectangular prism.- Specified by:
intersects
in interfaceShape3ai<ST extends Shape3ai<?,?,IE,P,V,B>,IT extends Path3ai<?,?,IE,P,V,B>,IE extends PathElement3ai,P extends Point3D<? super P,? super V>,V extends Vector3D<? super V,? super P>,B extends RectangularPrism3ai<?,?,IE,P,V,B>>
- Parameters:
rectangularPrism
- the rectangular prism.- Returns:
true
if this shape is intersecting the given shape;false
if there is no intersection.
-
intersects
@Pure default boolean intersects(Segment3ai<?,?,?,?,?,?> segment)
Description copied from interface:Shape3ai
Replies if this shape is intersecting the given segment.- Specified by:
intersects
in interfaceShape3ai<ST extends Shape3ai<?,?,IE,P,V,B>,IT extends Path3ai<?,?,IE,P,V,B>,IE extends PathElement3ai,P extends Point3D<? super P,? super V>,V extends Vector3D<? super V,? super P>,B extends RectangularPrism3ai<?,?,IE,P,V,B>>
- Parameters:
segment
- the segment- Returns:
true
if this shape is intersecting the given shape;false
if there is no intersection.
-
intersects
default boolean intersects(PathIterator3ai<?> iterator)
Description copied from interface:Shape3ai
Replies if this shape is intersecting the path described by the given iterator.- Specified by:
intersects
in interfaceShape3ai<ST extends Shape3ai<?,?,IE,P,V,B>,IT extends Path3ai<?,?,IE,P,V,B>,IE extends PathElement3ai,P extends Point3D<? super P,? super V>,V extends Vector3D<? super V,? super P>,B extends RectangularPrism3ai<?,?,IE,P,V,B>>
- Parameters:
iterator
- the path Iterator- Returns:
true
if this shape is intersecting the given shape;false
if there is no intersection.
-
intersects
@Pure default boolean intersects(MultiShape3ai<?,?,?,?,?,?,?> multishape)
Description copied from interface:Shape3ai
Replies if this shape is intersecting the given multishape.- Specified by:
intersects
in interfaceShape3ai<ST extends Shape3ai<?,?,IE,P,V,B>,IT extends Path3ai<?,?,IE,P,V,B>,IE extends PathElement3ai,P extends Point3D<? super P,? super V>,V extends Vector3D<? super V,? super P>,B extends RectangularPrism3ai<?,?,IE,P,V,B>>
- Parameters:
multishape
- the Ăčmultishape- Returns:
true
if this shape is intersecting the given shape;false
if there is no intersection.
-
getClosestPointTo
static void getClosestPointTo(PathIterator3ai<? extends PathElement3ai> pi, int x, int y, int z, Point3D<?,?> result)
Replies the point on the path that is closest to the given point.CAUTION: This function works only on path iterators that are replying polyline primitives, ie. if the
PathIterator3D.isPolyline()
ofpi
is replyingtrue
.getClosestPointTo(Point3D)
avoids this restriction.- Parameters:
pi
- is the iterator on the elements of the path.x
- x coordinate of the point.y
- y coordinate of the point.z
- z coordinate of the point.result
- the closest point on the shape; or the point itself if it is inside the shape.
-
getClosestPointTo
default P getClosestPointTo(Point3D<?,?> pt)
Description copied from interface:Shape3D
Replies the point on the shape that is closest to the given point.- Specified by:
getClosestPointTo
in interfaceShape3D<ST extends Shape3ai<?,?,IE,P,V,B>,IT extends Path3ai<?,?,IE,P,V,B>,IE extends PathElement3ai,P extends Point3D<? super P,? super V>,V extends Vector3D<? super V,? super P>,B extends RectangularPrism3ai<?,?,IE,P,V,B>>
- Parameters:
pt
- the point.- Returns:
- the closest point on the shape; or the point itself if it is inside the shape.
-
getClosestPointTo
default P getClosestPointTo(RectangularPrism3ai<?,?,?,?,?,?> rectangle)
Description copied from interface:Shape3ai
Replies the closest point on this shape to the given rectangle.- Specified by:
getClosestPointTo
in interfaceShape3ai<ST extends Shape3ai<?,?,IE,P,V,B>,IT extends Path3ai<?,?,IE,P,V,B>,IE extends PathElement3ai,P extends Point3D<? super P,? super V>,V extends Vector3D<? super V,? super P>,B extends RectangularPrism3ai<?,?,IE,P,V,B>>
- Parameters:
rectangle
- the rectangle.- Returns:
- the closest point on this shape to the given shape; or the point if the point is in this shape.
-
getClosestPointTo
default P getClosestPointTo(Sphere3ai<?,?,?,?,?,?> circle)
Description copied from interface:Shape3ai
Replies the closest point on this shape to the given rectangle.- Specified by:
getClosestPointTo
in interfaceShape3ai<ST extends Shape3ai<?,?,IE,P,V,B>,IT extends Path3ai<?,?,IE,P,V,B>,IE extends PathElement3ai,P extends Point3D<? super P,? super V>,V extends Vector3D<? super V,? super P>,B extends RectangularPrism3ai<?,?,IE,P,V,B>>
- Parameters:
circle
- the circle.- Returns:
- the closest point on this shape to the given shape; or the point if the point is in this shape.
-
getClosestPointTo
default P getClosestPointTo(Segment3ai<?,?,?,?,?,?> segment)
Description copied from interface:Shape3ai
Replies the closest point on this shape to the given rectangle.- Specified by:
getClosestPointTo
in interfaceShape3ai<ST extends Shape3ai<?,?,IE,P,V,B>,IT extends Path3ai<?,?,IE,P,V,B>,IE extends PathElement3ai,P extends Point3D<? super P,? super V>,V extends Vector3D<? super V,? super P>,B extends RectangularPrism3ai<?,?,IE,P,V,B>>
- Parameters:
segment
- the segment.- Returns:
- the closest point on this shape to the given shape; or the point if the point is in this shape.
-
getClosestPointTo
default P getClosestPointTo(MultiShape3ai<?,?,?,?,?,?,?> multishape)
Description copied from interface:Shape3ai
Replies the closest point on this shape to the given rectangle.- Specified by:
getClosestPointTo
in interfaceShape3ai<ST extends Shape3ai<?,?,IE,P,V,B>,IT extends Path3ai<?,?,IE,P,V,B>,IE extends PathElement3ai,P extends Point3D<? super P,? super V>,V extends Vector3D<? super V,? super P>,B extends RectangularPrism3ai<?,?,IE,P,V,B>>
- Parameters:
multishape
- the multishape.- Returns:
- the closest point on this shape to the given shape; or the point if the point is in this shape.
-
getClosestPointTo
default P getClosestPointTo(Path3ai<?,?,?,?,?,?> path)
Description copied from interface:Shape3ai
Replies the closest point on this shape to the given rectangle.- Specified by:
getClosestPointTo
in interfaceShape3ai<ST extends Shape3ai<?,?,IE,P,V,B>,IT extends Path3ai<?,?,IE,P,V,B>,IE extends PathElement3ai,P extends Point3D<? super P,? super V>,V extends Vector3D<? super V,? super P>,B extends RectangularPrism3ai<?,?,IE,P,V,B>>
- Parameters:
path
- the path.- Returns:
- the closest point on this shape to the given shape; or the point if the point is in this shape.
-
getFarthestPointTo
static void getFarthestPointTo(PathIterator3ai<? extends PathElement3ai> pi, int x, int y, int z, Point3D<?,?> result)
Replies the point on the path that is farthest to the given point.CAUTION: This function works only on path iterators that are replying polyline primitives, ie. if the
PathIterator3D.isPolyline()
ofpi
is replyingtrue
.getFarthestPointTo(Point3D)
avoids this restriction.- Parameters:
pi
- is the iterator on the elements of the path.x
- x coordinate of the point.y
- y coordinate of the point.z
- z coordinate of the point.result
- the farthest point on the shape.
-
getFarthestPointTo
default P getFarthestPointTo(Point3D<?,?> pt)
Description copied from interface:Shape3D
Replies the point on the shape that is farthest the given point.- Specified by:
getFarthestPointTo
in interfaceShape3D<ST extends Shape3ai<?,?,IE,P,V,B>,IT extends Path3ai<?,?,IE,P,V,B>,IE extends PathElement3ai,P extends Point3D<? super P,? super V>,V extends Vector3D<? super V,? super P>,B extends RectangularPrism3ai<?,?,IE,P,V,B>>
- Parameters:
pt
- the point.- Returns:
- the farthest point on the shape.
-
equalsToShape
@Pure default boolean equalsToShape(IT shape)
Description copied from interface:Shape3D
Replies this shape is equal to the given shape.- Specified by:
equalsToShape
in interfaceShape3D<ST extends Shape3ai<?,?,IE,P,V,B>,IT extends Path3ai<?,?,IE,P,V,B>,IE extends PathElement3ai,P extends Point3D<? super P,? super V>,V extends Vector3D<? super V,? super P>,B extends RectangularPrism3ai<?,?,IE,P,V,B>>
- Parameters:
shape
- the shape to compare to.- Returns:
true
if this shape is equal is equal to the given path.
-
add
default void add(Iterator<? extends PathElement3ai> iterator)
Add the elements replied by the iterator into this path.- Parameters:
iterator
- the iterator on the elements to add.
-
set
default void set(Path3ai<?,?,?,?,?,?> path)
Set the path.- Parameters:
path
- the path to copy.
-
moveTo
void moveTo(int x, int y, int z)
Adds a point to the path by moving to the specified coordinates specified in double precision.- Parameters:
x
- the specified X coordinatey
- the specified Y coordinatez
- the specified Y coordinate
-
moveTo
default void moveTo(Point3D<?,?> position)
Description copied from interface:Path3D
Adds a point to the path by moving to the specified coordinates specified in double precision.- Specified by:
moveTo
in interfacePath3D<ST extends Shape3ai<?,?,IE,P,V,B>,IT extends Path3ai<?,?,IE,P,V,B>,IE extends PathElement3ai,P extends Point3D<? super P,? super V>,V extends Vector3D<? super V,? super P>,B extends RectangularPrism3ai<?,?,IE,P,V,B>>
- Parameters:
position
- the new position.
-
lineTo
void lineTo(int x, int y, int z)
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:
x
- the specified X coordinatey
- the specified Y coordinatez
- the specified Y coordinate
-
lineTo
default void lineTo(Point3D<?,?> to)
Description copied from interface:Path3D
Adds a point to the path by drawing a straight line from the current coordinates to the new specified coordinates specified in double precision.- Specified by:
lineTo
in interfacePath3D<ST extends Shape3ai<?,?,IE,P,V,B>,IT extends Path3ai<?,?,IE,P,V,B>,IE extends PathElement3ai,P extends Point3D<? super P,? super V>,V extends Vector3D<? super V,? super P>,B extends RectangularPrism3ai<?,?,IE,P,V,B>>
- Parameters:
to
- the end point
-
quadTo
void quadTo(int x1, int y1, int z1, int x2, int y2, int z2)
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:
x1
- the X coordinate of the quadratic control pointy1
- the Y coordinate of the quadratic control pointz1
- the Z coordinate of the quadratic control pointx2
- the X coordinate of the final end pointy2
- the Y coordinate of the final end pointz2
- the Z coordinate of the final end point
-
quadTo
default void quadTo(Point3D<?,?> ctrl, Point3D<?,?> to)
Description copied from interface:Path3D
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.- Specified by:
quadTo
in interfacePath3D<ST extends Shape3ai<?,?,IE,P,V,B>,IT extends Path3ai<?,?,IE,P,V,B>,IE extends PathElement3ai,P extends Point3D<? super P,? super V>,V extends Vector3D<? super V,? super P>,B extends RectangularPrism3ai<?,?,IE,P,V,B>>
- Parameters:
ctrl
- the quadratic control pointto
- the final end point
-
curveTo
void curveTo(int x1, int y1, int z1, int x2, int y2, int z2, int x3, int y3, int z3)
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:
x1
- the X coordinate of the first Bézier control pointy1
- the Y coordinate of the first Bézier control pointz1
- the Z coordinate of the first Bézier control pointx2
- the X coordinate of the second Bézier control pointy2
- the Y coordinate of the second Bézier control pointz2
- the Z coordinate of the second Bézier control pointx3
- the X coordinate of the final end pointy3
- the Y coordinate of the final end pointz3
- the Z coordinate of the final end point
-
curveTo
default void curveTo(Point3D<?,?> ctrl1, Point3D<?,?> ctrl2, Point3D<?,?> to)
Description copied from interface:Path3D
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.- Specified by:
curveTo
in interfacePath3D<ST extends Shape3ai<?,?,IE,P,V,B>,IT extends Path3ai<?,?,IE,P,V,B>,IE extends PathElement3ai,P extends Point3D<? super P,? super V>,V extends Vector3D<? super V,? super P>,B extends RectangularPrism3ai<?,?,IE,P,V,B>>
- Parameters:
ctrl1
- the first Bézier control pointctrl2
- the second Bézier control pointto
- the final end point
-
getDistanceSquared
@Pure default double getDistanceSquared(Point3D<?,?> point)
Description copied from interface:Shape3D
Replies the squared value of the minimal distance from this shape to the given point.- Specified by:
getDistanceSquared
in interfaceShape3D<ST extends Shape3ai<?,?,IE,P,V,B>,IT extends Path3ai<?,?,IE,P,V,B>,IE extends PathElement3ai,P extends Point3D<? super P,? super V>,V extends Vector3D<? super V,? super P>,B extends RectangularPrism3ai<?,?,IE,P,V,B>>
- Parameters:
point
- the point.- Returns:
- squared value of the minimal distance between this shape and the point.
-
getDistanceL1
@Pure default double getDistanceL1(Point3D<?,?> point)
Description copied from interface:Shape3D
Computes the L-1 (Manhattan) distance between this shape and point p1. The L-1 distance is equal to abs(x1-x2) + abs(y1-y2).- Specified by:
getDistanceL1
in interfaceShape3D<ST extends Shape3ai<?,?,IE,P,V,B>,IT extends Path3ai<?,?,IE,P,V,B>,IE extends PathElement3ai,P extends Point3D<? super P,? super V>,V extends Vector3D<? super V,? super P>,B extends RectangularPrism3ai<?,?,IE,P,V,B>>
- Parameters:
point
- the point- Returns:
- the distance.
-
getDistanceLinf
@Pure default double getDistanceLinf(Point3D<?,?> point)
Description copied from interface:Shape3D
Computes the L-infinite distance between this shape and point p1. The L-infinite distance is equal to MAX[abs(x1-x2), abs(y1-y2), abs(z1-z2)].- Specified by:
getDistanceLinf
in interfaceShape3D<ST extends Shape3ai<?,?,IE,P,V,B>,IT extends Path3ai<?,?,IE,P,V,B>,IE extends PathElement3ai,P extends Point3D<? super P,? super V>,V extends Vector3D<? super V,? super P>,B extends RectangularPrism3ai<?,?,IE,P,V,B>>
- Parameters:
point
- the point.- Returns:
- the distance.
-
getLengthSquared
default double getLengthSquared()
Description copied from interface:Path3D
Replies the total squared length of the path.- Specified by:
getLengthSquared
in interfacePath3D<ST extends Shape3ai<?,?,IE,P,V,B>,IT extends Path3ai<?,?,IE,P,V,B>,IE extends PathElement3ai,P extends Point3D<? super P,? super V>,V extends Vector3D<? super V,? super P>,B extends RectangularPrism3ai<?,?,IE,P,V,B>>
- Returns:
- the length of the path.
-
getCurrentPoint
@Pure default P getCurrentPoint()
Description copied from interface:Path3D
Replies the last point in the path.- Specified by:
getCurrentPoint
in interfacePath3D<ST extends Shape3ai<?,?,IE,P,V,B>,IT extends Path3ai<?,?,IE,P,V,B>,IE extends PathElement3ai,P extends Point3D<? super P,? super V>,V extends Vector3D<? super V,? super P>,B extends RectangularPrism3ai<?,?,IE,P,V,B>>
- Returns:
- the last point.
-
getCurrentX
@Pure int getCurrentX()
Replies the x coordinate of the last point in the path.- Returns:
- the x coordinate of the last point in the path.
-
getCurrentY
@Pure int getCurrentY()
Replies the x coordinate of the last point in the path.- Returns:
- the x coordinate of the last point in the path.
-
getCurrentZ
@Pure int getCurrentZ()
Replies the z coordinate of the last point in the path.- Returns:
- the z coordinate of the last point in the path.
-
getCoordAt
@Pure int getCoordAt(int index)
Replies the coordinate at the given index. The index is in [0;Path3D.size()
*3).- Parameters:
index
- the index- Returns:
- the coordinate at the given index.
-
setLastPoint
void setLastPoint(int x, int y, int z)
Change the coordinates of the last inserted point.- Parameters:
x
- the new x coordinate of the last point.y
- the new y coordinate of the last point.z
- the new z coordinate of the last point.
-
setLastPoint
default void setLastPoint(Point3D<?,?> point)
Description copied from interface:Path3D
Change the coordinates of the last inserted point.- Specified by:
setLastPoint
in interfacePath3D<ST extends Shape3ai<?,?,IE,P,V,B>,IT extends Path3ai<?,?,IE,P,V,B>,IE extends PathElement3ai,P extends Point3D<? super P,? super V>,V extends Vector3D<? super V,? super P>,B extends RectangularPrism3ai<?,?,IE,P,V,B>>
- Parameters:
point
- the point.
-
transform
void transform(Transform3D transform)
Transform the current path. This function changes the current path.- Parameters:
transform
- is the affine transformation to apply.- See Also:
Shape3ai.createTransformedShape(org.arakhne.afc.math.geometry.d3.Transform3D)
-
remove
boolean remove(int x, int y, int z)
Remove the point with the given coordinates.If the given coordinates do not match exactly a point in the path, nothing is removed.
- Parameters:
x
- the x coordinate of the point to remove.y
- the y coordinate of the point to remove.z
- the z coordinate of the point to remove.- Returns:
true
if the point was removed;false
otherwise.
-
getPathIterator
@Pure default PathIterator3ai<IE> getPathIterator(double flatness)
Description copied from interface:Path3D
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.
- Specified by:
getPathIterator
in interfacePath3D<ST extends Shape3ai<?,?,IE,P,V,B>,IT extends Path3ai<?,?,IE,P,V,B>,IE extends PathElement3ai,P extends Point3D<? super P,? super V>,V extends Vector3D<? super V,? super P>,B extends RectangularPrism3ai<?,?,IE,P,V,B>>
- 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.
-
getPathIterator
@Pure default PathIterator3ai<IE> getPathIterator(Transform3D transform)
Description copied from interface:Shape3D
Replies the elements of the paths.- Specified by:
getPathIterator
in interfaceShape3D<ST extends Shape3ai<?,?,IE,P,V,B>,IT extends Path3ai<?,?,IE,P,V,B>,IE extends PathElement3ai,P extends Point3D<? super P,? super V>,V extends Vector3D<? super V,? super P>,B extends RectangularPrism3ai<?,?,IE,P,V,B>>
- Parameters:
transform
- is the transformation to apply to the path.- Returns:
- the elements of the path.
-
getPointIterator
@Pure default Iterator<P> getPointIterator()
Description copied from interface:Shape3ai
Replies an iterator on the points covered by the perimeter of this shape.The implementation of the iterator depends on the shape type. There is no warranty about the order of the points.
- Specified by:
getPointIterator
in interfaceShape3ai<ST extends Shape3ai<?,?,IE,P,V,B>,IT extends Path3ai<?,?,IE,P,V,B>,IE extends PathElement3ai,P extends Point3D<? super P,? super V>,V extends Vector3D<? super V,? super P>,B extends RectangularPrism3ai<?,?,IE,P,V,B>>
- Returns:
- an iterator on the points that are located at the perimeter of the shape.
-
toCollection
@Pure default Collection<P> toCollection()
Description copied from interface:Path3D
Replies the collection that is contains all the points of the path.- Specified by:
toCollection
in interfacePath3D<ST extends Shape3ai<?,?,IE,P,V,B>,IT extends Path3ai<?,?,IE,P,V,B>,IE extends PathElement3ai,P extends Point3D<? super P,? super V>,V extends Vector3D<? super V,? super P>,B extends RectangularPrism3ai<?,?,IE,P,V,B>>
- Returns:
- the point collection.
-
-