Interface Segment3afp<ST extends Shape3afp<?,?,IE,P,V,B>,IT extends Segment3afp<?,?,IE,P,V,B>,IE extends PathElement3afp,P extends Point3D<? super P,? super V>,V extends Vector3D<? super V,? super P>,B extends RectangularPrism3afp<?,?,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
,Serializable
,Shape3afp<ST,IT,IE,P,V,B>
,Shape3D<ST,IT,PathIterator3afp<IE>,P,V,B>
- All Known Implementing Classes:
Segment3d
,Segment3dfx
,SegmentPoint3d
public interface Segment3afp<ST extends Shape3afp<?,?,IE,P,V,B>,IT extends Segment3afp<?,?,IE,P,V,B>,IE extends PathElement3afp,P extends Point3D<? super P,? super V>,V extends Vector3D<? super V,? super P>,B extends RectangularPrism3afp<?,?,IE,P,V,B>> extends Shape3afp<ST,IT,IE,P,V,B>
Fonctional interface that represented a 2D segment/line on a plane.- Version:
- 17.0 2020-01-04 14:41:43
- Author:
- Stéphane GALLAND, Hamza JAFFALI, Thomas PIOTROWSKI
- Maven Group Id:
- org.arakhne.afc.core
- Maven Artifact Id:
- mathgeom
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
Segment3afp.SegmentPathIterator<T extends PathElement3afp>
Iterator on the path elements of the segment.static class
Segment3afp.UncertainIntersection
Result of the intersection between segments in a context where a single test is not enough.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description static int
ccw(double x1, double y1, double z1, double x2, double y2, double z2, double px, double py, double pz, double epsilon)
Replies the relative counterclockwise (CCW) of a segment against a point.default void
clear()
Reset this shape to be equivalent to an just-created instance of this shape type.default boolean
clipToRectangle(double rxmin, double rymin, double rzmin, double rxmax, double rymax, double rzmax)
Clip the segment against the clipping rectangle according to the Cohen-Sutherland algorithm.static void
computeClosestPointToPoint(double ax, double ay, double az, double bx, double by, double bz, double px, double py, double pz, Point3D<?,?> result)
Replies the point on the segment that is closest to the given point.static void
computeClosestPointToRectangle(double sx1, double sy1, double sz1, double sx2, double sy2, double sz2, double rx, double ry, double rz, double rwidth, double rheight, double rdepth, Point3D<?,?> result)
Replies the point on the segment that is closest to the rectangle.static double
computeClosestPointToSegment(double s1x1, double s1y1, double s1z1, double s1x2, double s1y2, double s1z2, double s2x1, double s2y1, double s2z1, double s2x2, double s2y2, double s2z2, Point3D<?,?> result)
Replies the point on the first segment that is closest to the second segment.static double
computeClosestPointToSegment(double s1x1, double s1y1, double s1z1, double s1x2, double s1y2, double s1z2, double s2x1, double s2y1, double s2z1, double s2x2, double s2y2, double s2z2, Point3D<?,?> resultOnFirstSegment, Point3D<?,?> resultOnSecondSegment)
Replies the point on the first segment that is closest to the second segment.static int
computeCrossingsFromPoint(double px, double py, double pz, double x0, double y0, double z0, double x1, double y1, double z1)
Calculates the number of times the line from (x0,y0,z0) to (x1,y1,z1) crosses the ray extending to the right from (px,py,pz).static int
computeCrossingsFromPointWithoutEquality(double px, double py, double pz, double x0, double y0, double z0, double x1, double y1, double z1)
Calculates the number of times the line from (x0,y0) to (x1,y1) crosses the ray extending to the right from (px,py).static int
computeCrossingsFromRect(int crossings, double rxmin, double rymin, double rzmin, double rxmax, double rymax, double rzmax, double x0, double y0, double z0, double x1, double y1, double z1)
Accumulate the number of times the line crosses the shadow extending to the right of the rectangle.static int
computeCrossingsFromSegment(int crossings, double sx1, double sy1, double sz1, double sx2, double sy2, double sz2, double x0, double y0, double z0, double x1, double y1, double z1)
Calculates the number of times the line from (x0,y0,z0) to (x1,y1,z1) crosses the segment (sx0,sy0,sz0) to (sx1,sy1,sz1) extending to the right.static int
computeCrossingsFromSphere(int crossings, double cx, double cy, double cz, double radius, double x0, double y0, double z0, double x1, double y1, double z1)
Calculates the number of times the line from (x0,y0,z0) to (x1,y1,z1) crosses the sphere (cx,cy,cz,radius) with radius extending to the right.static double
computeDistanceLinePoint(double x1, double y1, double z1, double x2, double y2, double z2, double px, double py, double pz)
Compute the distance between a point and a line.static double
computeDistanceSegmentPoint(double x1, double y1, double z1, double x2, double y2, double z2, double px, double py, double pz)
Compute the distance between a point and a segment.static double
computeDistanceSquaredLinePoint(double x1, double y1, double z1, double x2, double y2, double z2, double px, double py, double pz)
Compute the distance between a point and a line.static double
computeDistanceSquaredSegmentPoint(double x1, double y1, double z1, double x2, double y2, double z2, double px, double py, double pz)
Compute the square distance between a point and a segment.static void
computeFarthestPointTo(double ax, double ay, double az, double bx, double by, double bz, double px, double py, double pz, Point3D<?,?> result)
Replies the point on the segment that is farthest to the given point.static boolean
computeLineLineIntersection(double x1, double y1, double z1, double x2, double y2, double z2, double x3, double y3, double z3, double x4, double y4, double z4, Point3D<?,?> result)
Compute the intersection of two lines specified by the specified points and vectors.static double
computeLineLineIntersectionFactor(double x1, double y1, double z1, double x2, double y2, double z2, double x3, double y3, double z3, double x4, double y4, double z4)
Replies the position factory for the intersection point between two lines.static double
computeProjectedPointOnLine(double px, double py, double pz, double s1x, double s1y, double s1z, double s2x, double s2y, double s2z)
Replies the projection a point on a segment.static double
computeRelativeDistanceLinePoint(double x1, double y1, double z1, double x2, double y2, double z2, double px, double py, double pz)
Replies the relative distance from the given point to the given line.static boolean
computeSegmentSegmentIntersection(double x1, double y1, double z1, double x2, double y2, double z2, double x3, double y3, double z3, double x4, double y4, double z4, Point3D<?,?> result)
Replies the intersection point between two segments.static double
computeSegmentSegmentIntersectionFactor(double x1, double y1, double z1, double x2, double y2, double z2, double x3, double y3, double z3, double x4, double y4, double z4)
Replies one position factor for the intersection point between two lines.static org.eclipse.xtext.xbase.lib.Pair<Double,Double>
computeSegmentSegmentIntersectionFactors(double x1, double y1, double z1, double x2, double y2, double z2, double x3, double y3, double z3, double x4, double y4, double z4)
Replies one position factor for the intersection point between two lines.static int
computeSideLinePoint(double x1, double y1, double z1, double x2, double y2, double z2, double px, double py, double pz, double epsilon)
Replies on which side of a line the given point is located.default boolean
contains(double x, double y, double z)
Replies if the given point is inside this shape.default boolean
contains(RectangularPrism3afp<?,?,?,?,?,?> rectangularPrism)
Replies if the given rectangular prism is inside this shape.default boolean
equalsToShape(IT shape)
Replies this shape is equal to the given shape.default P
getClosestPointTo(Path3afp<?,?,?,?,?,?> path)
Replies the closest point on this shape to the given path.default P
getClosestPointTo(RectangularPrism3afp<?,?,?,?,?,?> rectangle)
Replies the closest point on this shape to the given rectangular prism.default P
getClosestPointTo(Segment3afp<?,?,?,?,?,?> segment)
Replies the closest point on this shape to the given segment.default P
getClosestPointTo(Sphere3afp<?,?,?,?,?,?> sphere)
Replies the closest point on this shape to the given sphere.default P
getClosestPointTo(Point3D<?,?> pt)
Replies the point on the shape that is closest to the given point.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.default P
getFarthestPointTo(Point3D<?,?> pt)
Replies the point on the shape that is farthest the given point.default double
getLength()
Replies the length of the segment.default double
getLengthSquared()
Replies the squared length of the segment.static Segment3afp.UncertainIntersection
getNoSegmentSegmentWithEndsIntersection(double x1, double y1, double z1, double x2, double y2, double z2, double x3, double y3, double z3, double x4, double y4, double z4)
Do an intersection test of two segments for ensuring that the answer of "no intersect" is safe.static Segment3afp.UncertainIntersection
getNoSegmentSegmentWithoutEndsIntersection(double x1, double y1, double z1, double x2, double y2, double z2, double x3, double y3, double z3, double x4, double y4, double z4)
Do an intersection test of two segments for ensuring that the answer of "no intersect" is safe.default P
getP1()
Replies the first point.default P
getP2()
Replies the second point.default PathIterator3afp<IE>
getPathIterator(Transform3D transform)
Replies the elements of the paths.double
getX1()
Replies the X of the first point.double
getX2()
Replies the X of the second point.double
getY1()
Replies the Y of the first point.double
getY2()
Replies the Y of the second point.double
getZ1()
Replies the Z of the first point.double
getZ2()
Replies the Z of the second point.static void
interpolate(double p1x, double p1y, double p1z, double p2x, double p2y, double p2z, double factor, Point3D<?,?> result)
Compute the interpolate point between the two points.default boolean
intersects(MultiShape3afp<?,?,?,?,?,?,?> multishape)
Replies if this shape is intersecting the given multishape.default boolean
intersects(PathIterator3afp<?> iterator)
Replies if this shape is intersecting the shape representing the given path iterator.default boolean
intersects(RectangularPrism3afp<?,?,?,?,?,?> prism)
Replies if this shape is intersecting the given Prism.default boolean
intersects(Segment3afp<?,?,?,?,?,?> segment)
Replies if this shape is intersecting the given line.default boolean
intersects(Sphere3afp<?,?,?,?,?,?> sphere)
Replies if this shape is intersecting the given circle.static boolean
intersectsLineLine(double x1, double y1, double z1, double x2, double y2, double z2, double x3, double y3, double z3, double x4, double y4, double z4)
Replies if two lines are intersecting.static boolean
intersectsSegmentLine(double x1, double y1, double z1, double x2, double y2, double z2, double x3, double y3, double z3, double x4, double y4, double z4)
Replies if a segment and a line are intersecting.static boolean
intersectsSegmentSegmentWithEnds(double x1, double y1, double z1, double x2, double y2, double z2, double x3, double y3, double z3, double x4, double y4, double z4)
Replies if two segments are intersecting.static boolean
intersectsSegmentSegmentWithoutEnds(double x1, double y1, double z1, double x2, double y2, double z2, double x3, double y3, double z3, double x4, double y4, double z4)
Replies if two segments are intersecting.static boolean
isCollinearLines(double x1, double y1, double z1, double x2, double y2, double z2, double x3, double y3, double z3, double x4, double y4, double z4)
Replies if two lines are colinear.default boolean
isEmpty()
Replies if this shape is empty.static boolean
isParallelLines(double x1, double y1, double z1, double x2, double y2, double z2, double x3, double y3, double z3, double x4, double y4, double z4)
Replies if two lines are parallel.static boolean
isPointClosedToLine(double x1, double y1, double z1, double x2, double y2, double z2, double x, double y, double z, double hitDistance)
Replies if a point is closed to a line.static boolean
isPointClosedToSegment(double x1, double y1, double z1, double x2, double y2, double z2, double x, double y, double z, double hitDistance)
Replies if a point is closed to a segment.void
set(double x1, double y1, double z1, double x2, double y2, double z2)
Change the line.default void
set(IT shape)
Set this shape with the attributes of the given shape.default void
set(Point3D<?,?> firstPoint, Point3D<?,?> secondPoint)
Change the line.default void
setP1(double x, double y, double z)
Change the first point.default void
setP1(Point3D<?,?> point)
Change the first point.default void
setP2(double x, double y, double z)
Change the first point.default void
setP2(Point3D<?,?> point)
Change the second point.void
setX1(double x)
Sets a new value in the X of the first point.void
setX2(double x)
Sets a new value in the X of the second point.void
setY1(double y)
Sets a new value in the Y of the first point.void
setY2(double y)
Sets a new value in the Y of the second point.void
setZ1(double z)
Sets a new value in the Z of the first point.void
setZ2(double z)
Sets a new value in the Z of the second point.default void
toBoundingBox(B box)
Replies the bounds of the shape.default void
transform(Transform3D transform)
Transform the current segment.default void
translate(double dx, double dy, double dz)
Translate the shape.-
Methods inherited from interface org.arakhne.afc.vmutil.json.JsonableObject
toJson
-
Methods inherited from interface org.arakhne.afc.math.geometry.d3.afp.Shape3afp
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.d3.Shape3D
clone, equalsToPathIterator, getDistance, getDistance, getPathIterator, operator_add, operator_and, operator_and, operator_minus, operator_multiply, operator_plus, operator_remove, operator_upTo
-
-
-
-
Method Detail
-
isCollinearLines
@Pure static boolean isCollinearLines(double x1, double y1, double z1, double x2, double y2, double z2, double x3, double y3, double z3, double x4, double y4, double z4)
Replies if two lines are colinear.The given two lines are described respectivaly by two points, i.e.
(x1,y1)
and(x2,y2)
for the first line, and(x3,y3)
and(x4,y4)
for the second line.If you are interested to test if the two lines are parallel, see
isParallelLines(double, double, double, double, double, double, double, double, double, double, double, double)
.- Parameters:
x1
- is the X coordinate of the first point of the first line.y1
- is the Y coordinate of the first point of the first line.z1
- is the Z coordinate of the first point of the first line.x2
- is the X coordinate of the second point of the first line.y2
- is the Y coordinate of the second point of the first line.z2
- is the Z coordinate of the second point of the first line.x3
- is the X coordinate of the first point of the second line.y3
- is the Y coordinate of the first point of the second line.z3
- is the Z coordinate of the first point of the second line.x4
- is the X coordinate of the second point of the second line.y4
- is the Y coordinate of the second point of the second line.z4
- is the Z coordinate of the second point of the second line.- Returns:
true
if the two given lines are collinear.- See Also:
isParallelLines(double, double, double, double, double, double, double, double, double, double, double, double)
,Point3D.isCollinearPoints(double, double, double, double, double, double, double, double, double)
-
isParallelLines
@Pure static boolean isParallelLines(double x1, double y1, double z1, double x2, double y2, double z2, double x3, double y3, double z3, double x4, double y4, double z4)
Replies if two lines are parallel.The given two lines are described respectivaly by two points, i.e.
(x1,y1)
and(x2,y2)
for the first line, and(x3,y3)
and(x4,y4)
for the second line.If you are interested to test if the two lines are colinear, see
isCollinearLines(double, double, double, double, double, double, double, double, double, double, double, double)
.- Parameters:
x1
- is the X coordinate of the first point of the first line.y1
- is the Y coordinate of the first point of the first line.z1
- is the Z coordinate of the first point of the first line.x2
- is the X coordinate of the second point of the first line.y2
- is the Y coordinate of the second point of the first line.z2
- is the Z coordinate of the second point of the first line.x3
- is the X coordinate of the first point of the second line.y3
- is the Y coordinate of the first point of the second line.z3
- is the Z coordinate of the first point of the second line.x4
- is the X coordinate of the second point of the second line.y4
- is the Y coordinate of the second point of the second line.z4
- is the Z coordinate of the second point of the second line.- Returns:
true
if the two given lines are parallel.- See Also:
isCollinearLines(double, double, double, double, double, double, double, double, double, double, double, double)
-
computeSegmentSegmentIntersection
@Pure static boolean computeSegmentSegmentIntersection(double x1, double y1, double z1, double x2, double y2, double z2, double x3, double y3, double z3, double x4, double y4, double z4, Point3D<?,?> result)
Replies the intersection point between two segments.- Parameters:
x1
- is the X coordinate of the first point of the first line.y1
- is the Y coordinate of the first point of the first line.z1
- is the Z coordinate of the first point of the first line.x2
- is the X coordinate of the second point of the first line.y2
- is the Y coordinate of the second point of the first line.z2
- is the Z coordinate of the second point of the first line.x3
- is the X coordinate of the first point of the second line.y3
- is the Y coordinate of the first point of the second line.z3
- is the Z coordinate of the first point of the second line.x4
- is the X coordinate of the second point of the second line.y4
- is the Y coordinate of the second point of the second line.z4
- is the Z coordinate of the second point of the second line.result
- the intersection point.- Returns:
true
if an intersection exists.
-
computeSegmentSegmentIntersectionFactor
@Pure static double computeSegmentSegmentIntersectionFactor(double x1, double y1, double z1, double x2, double y2, double z2, double x3, double y3, double z3, double x4, double y4, double z4)
Replies one position factor for the intersection point between two lines.Let line equations for L1 and L2:
L1: P1 + factor1 * (P2-P1)
L2: P3 + factor2 * (P4-P3)
If lines are intersecting, then
P1 + factor1 * (P2-P1) = P3 + factor2 * (P4-P3)
This function computes and replies
factor1
.- Parameters:
x1
- is the X coordinate of the first point of the first line.y1
- is the Y coordinate of the first point of the first line.z1
- is the Z coordinate of the first point of the first line.x2
- is the X coordinate of the second point of the first line.y2
- is the Y coordinate of the second point of the first line.z2
- is the Z coordinate of the second point of the first line.x3
- is the X coordinate of the first point of the second line.y3
- is the Y coordinate of the first point of the second line.z3
- is the Z coordinate of the first point of the second line.x4
- is the X coordinate of the second point of the second line.y4
- is the Y coordinate of the second point of the second line.z4
- is the Z coordinate of the second point of the second line.- Returns:
factor1
orDouble.NaN
if no intersection.
-
computeSegmentSegmentIntersectionFactors
@Pure static org.eclipse.xtext.xbase.lib.Pair<Double,Double> computeSegmentSegmentIntersectionFactors(double x1, double y1, double z1, double x2, double y2, double z2, double x3, double y3, double z3, double x4, double y4, double z4)
Replies one position factor for the intersection point between two lines.Let line equations for L1 and L2:
L1: P1 + factor1 * (P2-P1)
L2: P3 + factor2 * (P4-P3)
If lines are intersecting, then
P1 + factor1 * (P2-P1) = P3 + factor2 * (P4-P3)
This function computes and replies
factor1
.- Parameters:
x1
- is the X coordinate of the first point of the first line.y1
- is the Y coordinate of the first point of the first line.z1
- is the Z coordinate of the first point of the first line.x2
- is the X coordinate of the second point of the first line.y2
- is the Y coordinate of the second point of the first line.z2
- is the Z coordinate of the second point of the first line.x3
- is the X coordinate of the first point of the second line.y3
- is the Y coordinate of the first point of the second line.z3
- is the Z coordinate of the first point of the second line.x4
- is the X coordinate of the second point of the second line.y4
- is the Y coordinate of the second point of the second line.z4
- is the Z coordinate of the second point of the second line.- Returns:
factor1
orDouble.NaN
if no intersection.
-
computeLineLineIntersectionFactor
@Pure static double computeLineLineIntersectionFactor(double x1, double y1, double z1, double x2, double y2, double z2, double x3, double y3, double z3, double x4, double y4, double z4)
Replies the position factory for the intersection point between two lines.Let line equations for L1 and L2:
L1: P1 + factor1 * (P2-P1)
L2: P3 + factor2 * (P4-P3)
If lines are intersecting, then
P1 + factor1 * (P2-P1) = P3 + factor2 * (P4-P3)
This function computes and replies
factor1
.- Parameters:
x1
- is the X coordinate of the first point of the first line.y1
- is the Y coordinate of the first point of the first line.z1
- is the Z coordinate of the first point of the first line.x2
- is the X coordinate of the second point of the first line.y2
- is the Y coordinate of the second point of the first line.z2
- is the Z coordinate of the second point of the first line.x3
- is the X coordinate of the first point of the second line.y3
- is the Y coordinate of the first point of the second line.z3
- is the Z coordinate of the first point of the second line.x4
- is the X coordinate of the second point of the second line.y4
- is the Y coordinate of the second point of the second line.z4
- is the Z coordinate of the second point of the second line.- Returns:
factor1
orDouble.NaN
if no intersection.
-
computeLineLineIntersection
@Pure static boolean computeLineLineIntersection(double x1, double y1, double z1, double x2, double y2, double z2, double x3, double y3, double z3, double x4, double y4, double z4, Point3D<?,?> result)
Compute the intersection of two lines specified by the specified points and vectors.- Parameters:
x1
- x position of the first point of the line.y1
- y position of the first point of the line.z1
- z position of the first point of the line.x2
- x position of the second point of the line.y2
- y position of the second point of the line.z2
- z position of the second point of the line.x3
- x position of the first point of the line.y3
- y position of the first point of the line.z3
- z position of the first point of the line.x4
- x position of the second point of the line.y4
- y position of the second point of the line.z4
- z position of the second point of the line.result
- the intersection point.- Returns:
true
if there is an intersection.
-
computeDistanceSquaredLinePoint
@Pure static double computeDistanceSquaredLinePoint(double x1, double y1, double z1, double x2, double y2, double z2, double px, double py, double pz)
Compute the distance between a point and a line.- Parameters:
x1
- x position of the first point of the line.y1
- y position of the first point of the line.z1
- z position of the first point of the line.x2
- x position of the second point of the line.y2
- y position of the second point of the line.z2
- z position of the second point of the line.px
- x position of the point.py
- y position of the point.pz
- z position of the point.- Returns:
- the distance beetween the point and the line.
- See Also:
computeDistanceLinePoint(double, double, double, double, double, double, double, double, double)
-
computeDistanceSquaredSegmentPoint
static double computeDistanceSquaredSegmentPoint(double x1, double y1, double z1, double x2, double y2, double z2, double px, double py, double pz)
Compute the square distance between a point and a segment.- Parameters:
x1
- x position of the first point of the segment.y1
- y position of the first point of the segment.z1
- z position of the first point of the segment.x2
- x position of the second point of the segment.y2
- y position of the second point of the segment.z2
- y position of the second point of the segment.px
- x position of the point.py
- y position of the point.pz
- z position of the point.- Returns:
- the distance beetween the point and the segment.
-
computeDistanceSegmentPoint
static double computeDistanceSegmentPoint(double x1, double y1, double z1, double x2, double y2, double z2, double px, double py, double pz)
Compute the distance between a point and a segment.- Parameters:
x1
- x position of the first point of the segment.y1
- y position of the first point of the segment.z1
- z position of the first point of the segment.x2
- x position of the second point of the segment.y2
- y position of the second point of the segment.z2
- z position of the second point of the segment.px
- x position of the point.py
- y position of the point.pz
- z position of the point.- Returns:
- the distance beetween the point and the segment.
-
computeDistanceLinePoint
@Pure static double computeDistanceLinePoint(double x1, double y1, double z1, double x2, double y2, double z2, double px, double py, double pz)
Compute the distance between a point and a line.- Parameters:
x1
- x position of the first point of the line.y1
- y position of the first point of the line.z1
- z position of the first point of the line.x2
- x position of the second point of the line.y2
- y position of the second point of the line.z2
- z position of the second point of the line.px
- x position of the point.py
- y position of the point.pz
- z position of the point.- Returns:
- the distance beetween the point and the line.
- See Also:
computeDistanceSquaredLinePoint(double, double, double, double, double, double, double, double, double)
,computeRelativeDistanceLinePoint(double, double, double, double, double, double, double, double, double)
-
isPointClosedToSegment
@Pure static boolean isPointClosedToSegment(double x1, double y1, double z1, double x2, double y2, double z2, double x, double y, double z, double hitDistance)
Replies if a point is closed to a segment.- Parameters:
x1
- x location of the segment begining.y1
- y location of the segment begining.z1
- z location of the segment begining.x2
- x location of the second-segment ending.y2
- y location of the second-segment ending.z2
- z location of the second-segment ending.x
- x location of the point.y
- y location of the point.z
- z location of the point.hitDistance
- is the maximal hitting distance.- Returns:
true
if the point and the line have closed locations.
-
isPointClosedToLine
@Pure static boolean isPointClosedToLine(double x1, double y1, double z1, double x2, double y2, double z2, double x, double y, double z, double hitDistance)
Replies if a point is closed to a line.- Parameters:
x1
- x location of the line begining.y1
- y location of the line begining.z1
- z location of the line begining.x2
- x location of the line ending.y2
- y location of the line ending.z2
- z location of the line ending.x
- x location of the point.y
- y location of the point.z
- z location of the point.hitDistance
- is the maximal hitting distance.- Returns:
true
if the point and the line have closed locations.
-
computeProjectedPointOnLine
@Pure static double computeProjectedPointOnLine(double px, double py, double pz, double s1x, double s1y, double s1z, double s2x, double s2y, double s2z)
Replies the projection a point on a segment.- Parameters:
px
- is the coordiante of the point to projectpy
- is the coordiante of the point to projectpz
- is the coordiante of the point to projects1x
- is the x-coordinate of the first line point.s1y
- is the y-coordinate of the first line point.s1z
- is the z-coordinate of the first line point.s2x
- is the x-coordinate of the second line point.s2y
- is the y-coordinate of the second line point.s2z
- is the z-coordinate of the second line point.- Returns:
- the projection of the specified point on the line. If
equal to
0
, the projection is equal to the first segment point. If equal to1
, the projection is equal to the second segment point. If inside]0;1[
, the projection is between the two segment points. If inside]-inf;0[
, the projection is outside on the side of the first segment point. If inside]1;+inf[
, the projection is outside on the side of the second segment point.
-
computeRelativeDistanceLinePoint
@Pure static double computeRelativeDistanceLinePoint(double x1, double y1, double z1, double x2, double y2, double z2, double px, double py, double pz)
Replies the relative distance from the given point to the given line. The replied distance may be negative, depending on which side of the line the point is.- Parameters:
x1
- the X coordinate of the start point of the specified line segmenty1
- the Y coordinate of the start point of the specified line segmentz1
- the Z coordinate of the start point of the specified line segmentx2
- the X coordinate of the end point of the specified line segmenty2
- the Y coordinate of the end point of the specified line segmentz2
- the Z coordinate of the end point of the specified line segmentpx
- the X coordinate of the specified point to be compared with the specified line segmentpy
- the Y coordinate of the specified point to be compared with the specified line segmentpz
- the Z coordinate of the specified point to be compared with the specified line segment- Returns:
- the positive or negative distance from the point to the line
- See Also:
ccw(double, double, double, double, double, double, double, double, double, double)
,computeSideLinePoint(double, double, double, double, double, double, double, double, double, double)
-
computeSideLinePoint
@Pure static int computeSideLinePoint(double x1, double y1, double z1, double x2, double y2, double z2, double px, double py, double pz, double epsilon)
Replies on which side of a line the given point is located.A return value of 1 indicates that the line segment must turn in the direction that takes the positive X axis towards the negative Y axis. In the default coordinate system used by Java 2D, this direction is counterclockwise.
A return value of -1 indicates that the line segment must turn in the direction that takes the positive X axis towards the positive Y axis. In the default coordinate system, this direction is clockwise.
A return value of 0 indicates that the point lies exactly on the line segment. Note that an indicator value of 0 is rare and not useful for determining colinearity because of floating point rounding issues.
This function uses the equal-to-zero test with the error
Math.ulp(double)
.In opposite of
ccw(double, double, double, double, double, double, double, double, double, double)
, this function does not try to classify the point if it is colinear to the segment. If the point is colinear, O is always returned.- Parameters:
x1
- the X coordinate of the start point of the specified line segmenty1
- the Y coordinate of the start point of the specified line segmentz1
- the Z coordinate of the start point of the specified line segmentx2
- the X coordinate of the end point of the specified line segmenty2
- the Y coordinate of the end point of the specified line segmentz2
- the Z coordinate of the end point of the specified line segmentpx
- the X coordinate of the specified point to be compared with the specified line segmentpy
- the Y coordinate of the specified point to be compared with the specified line segmentpz
- the Z coordinate of the specified point to be compared with the specified line segmentepsilon
- approximate epsilon.- Returns:
- an integer that indicates the position of the third specified coordinates with respect to the line segment formed by the first two specified coordinates.
- See Also:
computeRelativeDistanceLinePoint(double, double, double, double, double, double, double, double, double)
,MathUtil.isEpsilonZero(double)
,ccw(double, double, double, double, double, double, double, double, double, double)
-
ccw
@Pure static int ccw(double x1, double y1, double z1, double x2, double y2, double z2, double px, double py, double pz, double epsilon)
Replies the relative counterclockwise (CCW) of a segment against a point. Returns an indicator of where the specified point(px,py)
lies with respect to the line segment from(x1,y1)
to(x2,y2)
. The return value can be either 1, -1, or 0 and indicates in which direction the specified line must pivot around its first end point,(x1,y1)
, in order to point at the specified point(px,py)
. In other words, given three point P1, P2, and P, is the segments (P1-P2-P) a counterclockwise turn?In opposite to
computeSideLinePoint(double, double, double, double, double, double, double, double, double, double)
, this function tries to classifies the point if it is colinear to the segment. The classification is explained below.A return value of 1 indicates that the line segment must turn in the direction that takes the positive X axis towards the negative Y axis. In the default coordinate system used by Java 2D, this direction is counterclockwise.
A return value of -1 indicates that the line segment must turn in the direction that takes the positive X axis towards the positive Y axis. In the default coordinate system, this direction is clockwise.
A return value of 0 indicates that the point lies exactly on the line segment. Note that an indicator value of 0 is rare and not useful for determining colinearity because of floating point rounding issues.
If the point is colinear with the line segment, but not between the end points, then the value will be -1 if the point lies "beyond
(x1,y1)
" or 1 if the point lies "beyond(x2,y2)
".- Parameters:
x1
- the X coordinate of the start point of the specified line segmenty1
- the Y coordinate of the start point of the specified line segmentz1
- the Z coordinate of the start point of the specified line segmentx2
- the X coordinate of the end point of the specified line segmenty2
- the Y coordinate of the end point of the specified line segmentz2
- the Z coordinate of the end point of the specified line segmentpx
- the X coordinate of the specified point to be compared with the specified line segmentpy
- the Y coordinate of the specified point to be compared with the specified line segmentpz
- the Z coordinate of the specified point to be compared with the specified line segmentepsilon
- approximation of the tests for equality to zero.- Returns:
- an integer that indicates the position of the third specified coordinates with respect to the line segment formed by the first two specified coordinates.
- See Also:
computeRelativeDistanceLinePoint(double, double, double, double, double, double, double, double, double)
,computeSideLinePoint(double, double, double, double, double, double, double, double, double, double)
-
interpolate
@Pure static void interpolate(double p1x, double p1y, double p1z, double p2x, double p2y, double p2z, double factor, Point3D<?,?> result)
Compute the interpolate point between the two points.- Parameters:
p1x
- x coordinate of the first point.p1y
- y coordinate of the first point.p1z
- z coordinate of the first point.p2x
- x coordinate of the second point.p2y
- y coordinate of the second point.p2z
- z coordinate of the second point.factor
- is between 0 and 1; 0 for p1, and 1 for p2.result
- the interpolated point.
-
computeFarthestPointTo
@Pure static void computeFarthestPointTo(double ax, double ay, double az, double bx, double by, double bz, double px, double py, double pz, Point3D<?,?> result)
Replies the point on the segment that is farthest to the given point.- Parameters:
ax
- is the x coordinate of the first point of the segment.ay
- is the y coordinate of the first point of the segment.az
- is the z coordinate of the first point of the segment.bx
- is the x coordinate of the second point of the segment.by
- is the y coordinate of the second point of the segment.bz
- is the z coordinate of the second point of the segment.px
- is the x coordinate of the point.py
- is the y coordinate of the point.pz
- is the z coordinate of the point.result
- the farthest point on the shape.
-
computeClosestPointToPoint
@Pure static void computeClosestPointToPoint(double ax, double ay, double az, double bx, double by, double bz, double px, double py, double pz, Point3D<?,?> result)
Replies the point on the segment that is closest to the given point.- Parameters:
ax
- is the x coordinate of the first point of the segment.ay
- is the y coordinate of the first point of the segment.az
- is the z coordinate of the first point of the segment.bx
- is the x coordinate of the second point of the segment.by
- is the y coordinate of the second point of the segment.bz
- is the z coordinate of the second point of the segment.px
- is the x coordinate of the point.py
- is the y coordinate of the point.pz
- is the z coordinate of the point.result
- the is point on the shape.
-
computeClosestPointToRectangle
@Pure static void computeClosestPointToRectangle(double sx1, double sy1, double sz1, double sx2, double sy2, double sz2, double rx, double ry, double rz, double rwidth, double rheight, double rdepth, Point3D<?,?> result)
Replies the point on the segment that is closest to the rectangle.- Parameters:
sx1
- is the x coordinate of the first point of the segment.sy1
- is the y coordinate of the first point of the segment.sz1
- is the z coordinate of the first point of the segment.sx2
- is the x coordinate of the second point of the segment.sy2
- is the y coordinate of the second point of the segment.sz2
- is the z coordinate of the second point of the segment.rx
- is the x coordinate of the rectangle.ry
- is the y coordinate of the rectangle.rz
- is the z coordinate of the rectangle.rwidth
- is the width of the rectangle.rheight
- is the height of the rectangle.rdepth
- is the depth of the rectangle.result
- the is point on the segment.
-
computeClosestPointToSegment
@Pure static double computeClosestPointToSegment(double s1x1, double s1y1, double s1z1, double s1x2, double s1y2, double s1z2, double s2x1, double s2y1, double s2z1, double s2x2, double s2y2, double s2z2, Point3D<?,?> result)
Replies the point on the first segment that is closest to the second segment.- Parameters:
s1x1
- is the x coordinate of the first point of the first segment.s1y1
- is the y coordinate of the first point of the first segment.s1z1
- is the z coordinate of the first point of the first segment.s1x2
- is the x coordinate of the second point of the first segment.s1y2
- is the y coordinate of the second point of the first segment.s1z2
- is the z coordinate of the second point of the first segment.s2x1
- is the x coordinate of the first point of the second segment.s2y1
- is the y coordinate of the first point of the second segment.s2z1
- is the z coordinate of the first point of the second segment.s2x2
- is the x coordinate of the second point of the second segment.s2y2
- is the y coordinate of the second point of the second segment.s2z2
- is the z coordinate of the second point of the second segment.result
- the is point on the shape.- Returns:
- the square distance between the segments.
-
computeClosestPointToSegment
@Pure static double computeClosestPointToSegment(double s1x1, double s1y1, double s1z1, double s1x2, double s1y2, double s1z2, double s2x1, double s2y1, double s2z1, double s2x2, double s2y2, double s2z2, Point3D<?,?> resultOnFirstSegment, Point3D<?,?> resultOnSecondSegment)
Replies the point on the first segment that is closest to the second segment.- Parameters:
s1x1
- is the x coordinate of the first point of the first segment.s1y1
- is the y coordinate of the first point of the first segment.s1z1
- is the z coordinate of the first point of the first segment.s1x2
- is the x coordinate of the second point of the first segment.s1y2
- is the y coordinate of the second point of the first segment.s1z2
- is the z coordinate of the second point of the first segment.s2x1
- is the x coordinate of the first point of the second segment.s2y1
- is the y coordinate of the first point of the second segment.s2z1
- is the z coordinate of the first point of the second segment.s2x2
- is the x coordinate of the second point of the second segment.s2y2
- is the y coordinate of the second point of the second segment.s2z2
- is the z coordinate of the second point of the second segment.resultOnFirstSegment
- the point on the first segment.resultOnSecondSegment
- the point on the second segment.- Returns:
- the square distance between the segments.
-
computeCrossingsFromPoint
@Pure static int computeCrossingsFromPoint(double px, double py, double pz, double x0, double y0, double z0, double x1, double y1, double z1)
Calculates the number of times the line from (x0,y0,z0) to (x1,y1,z1) crosses the ray extending to the right from (px,py,pz). If the point lies on the line, then no crossings are recorded. +1 is returned for a crossing where the Y coordinate is increasing -1 is returned for a crossing where the Y coordinate is decreasingThis function differs from
computeCrossingsFromPointWithoutEquality(double, double, double, double, double, double, double, double, double)
. The equality test is used in this function.- Parameters:
px
- is the reference point to test.py
- is the reference point to test.pz
- is the reference point to test.x0
- is the first point of the line.y0
- is the first point of the line.z0
- is the first point of the line.x1
- is the second point of the line.y1
- is the secondpoint of the line.z1
- is the secondpoint of the line.- Returns:
- the crossing.
-
computeCrossingsFromPointWithoutEquality
@Pure static int computeCrossingsFromPointWithoutEquality(double px, double py, double pz, double x0, double y0, double z0, double x1, double y1, double z1)
Calculates the number of times the line from (x0,y0) to (x1,y1) crosses the ray extending to the right from (px,py). If the point lies on the line, then no crossings are recorded. +1 is returned for a crossing where the Y coordinate is increasing -1 is returned for a crossing where the Y coordinate is decreasingThis function differs from
computeCrossingsFromPoint(double, double, double, double, double, double, double, double, double)
. The equality test is not used in this function.- Parameters:
px
- is the reference point to test.py
- is the reference point to test.pz
- is the reference point to test.x0
- is the first point of the line.y0
- is the first point of the line.z0
- is the first point of the line.x1
- is the second point of the line.y1
- is the second point of the line.z1
- is the second point of the line.- Returns:
- the crossing.
-
computeCrossingsFromSegment
@Pure static int computeCrossingsFromSegment(int crossings, double sx1, double sy1, double sz1, double sx2, double sy2, double sz2, double x0, double y0, double z0, double x1, double y1, double z1)
Calculates the number of times the line from (x0,y0,z0) to (x1,y1,z1) crosses the segment (sx0,sy0,sz0) to (sx1,sy1,sz1) extending to the right.- Parameters:
crossings
- is the initial value for the number of crossings.sx1
- is the first point of the segment to extend.sy1
- is the first point of the segment to extend.sz1
- is the first point of the segment to extend.sx2
- is the second point of the segment to extend.sy2
- is the second point of the segment to extend.sz2
- is the second point of the segment to extend.x0
- is the first point of the line.y0
- is the first point of the line.z0
- is the first point of the line.x1
- is the second point of the line.y1
- is the second point of the line.z1
- is the second point of the line.- Returns:
- the crossing, or
MathConstants#SHAPE_INTERSECTS
-
computeCrossingsFromSphere
@Pure static int computeCrossingsFromSphere(int crossings, double cx, double cy, double cz, double radius, double x0, double y0, double z0, double x1, double y1, double z1)
Calculates the number of times the line from (x0,y0,z0) to (x1,y1,z1) crosses the sphere (cx,cy,cz,radius) with radius extending to the right.- Parameters:
crossings
- is the initial value for the number of crossings.cx
- is the center of the circle to extend.cy
- is the center of the circle to extend.cz
- is the center of the circle to extend.radius
- is the radius of the circle to extend.x0
- is the first point of the line.y0
- is the first point of the line.z0
- is the first point of the line.x1
- is the second point of the line.y1
- is the secondpoint of the line.z1
- is the secondpoint of the line.- Returns:
- the crossing, or
GeomConstants.SHAPE_INTERSECTS
.
-
computeCrossingsFromRect
@Pure static int computeCrossingsFromRect(int crossings, double rxmin, double rymin, double rzmin, double rxmax, double rymax, double rzmax, double x0, double y0, double z0, double x1, double y1, double z1)
Accumulate the number of times the line crosses the shadow extending to the right of the rectangle. See the comment for theGeomConstants.SHAPE_INTERSECTS
constant for more complete details.- Parameters:
crossings
- is the initial value for the number of crossings.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.x0
- is the first point of the line.y0
- is the first point of the line.z0
- is the first point of the line.x1
- is the second point of the line.y1
- is the secondpoint of the line.z1
- is the secondpoint of the line.- Returns:
- the crossing, or
GeomConstants.SHAPE_INTERSECTS
.
-
intersectsLineLine
@Pure static boolean intersectsLineLine(double x1, double y1, double z1, double x2, double y2, double z2, double x3, double y3, double z3, double x4, double y4, double z4)
Replies if two lines are intersecting.- Parameters:
x1
- is the first point of the first line.y1
- is the first point of the first line.z1
- is the first point of the first line.x2
- is the second point of the first line.y2
- is the second point of the first line.z2
- is the second point of the first line.x3
- is the first point of the second line.y3
- is the first point of the second line.z3
- is the first point of the second line.x4
- is the second point of the second line.y4
- is the second point of the second line.z4
- is the second point of the second line.- Returns:
true
if the two shapes are intersecting; otherwisefalse
-
intersectsSegmentLine
@Pure static boolean intersectsSegmentLine(double x1, double y1, double z1, double x2, double y2, double z2, double x3, double y3, double z3, double x4, double y4, double z4)
Replies if a segment and a line are intersecting.- Parameters:
x1
- is the first point of the first segment.y1
- is the first point of the first segment.z1
- is the first point of the first segment.x2
- is the second point of the first segment.y2
- is the second point of the first segment.z2
- is the second point of the first segment.x3
- is the first point of the second line.y3
- is the first point of the second line.z3
- is the first point of the second line.x4
- is the second point of the second line.y4
- is the second point of the second line.z4
- is the second point of the second line.- Returns:
true
if the two shapes are intersecting; otherwisefalse
-
getNoSegmentSegmentWithEndsIntersection
@Pure static Segment3afp.UncertainIntersection getNoSegmentSegmentWithEndsIntersection(double x1, double y1, double z1, double x2, double y2, double z2, double x3, double y3, double z3, double x4, double y4, double z4)
Do an intersection test of two segments for ensuring that the answer of "no intersect" is safe.If the function replies
Segment3afp.UncertainIntersection.NO
, we are sure that the two given segments are not intersecting. If the function repliesSegment3afp.UncertainIntersection.PERHAPS
, the two segments may intersects (uncertain answer).This function considers that the ends of the segments are intersecting.
- Parameters:
x1
- is the first point of the first segment.y1
- is the first point of the first segment.z1
- is the first point of the first segment.x2
- is the second point of the first segment.y2
- is the second point of the first segment.z2
- is the second point of the first segment.x3
- is the first point of the second segment.y3
- is the first point of the second segment.z3
- is the first point of the second segment.x4
- is the second point of the second segment.y4
- is the second point of the second segment.z4
- is the second point of the second segment.- Returns:
- the type of intersection.
- See Also:
intersectsSegmentSegmentWithEnds(double, double, double, double, double, double, double, double, double, double, double, double)
-
getNoSegmentSegmentWithoutEndsIntersection
@Pure static Segment3afp.UncertainIntersection getNoSegmentSegmentWithoutEndsIntersection(double x1, double y1, double z1, double x2, double y2, double z2, double x3, double y3, double z3, double x4, double y4, double z4)
Do an intersection test of two segments for ensuring that the answer of "no intersect" is safe. If the function repliestrue
, it may This function does not consider that the ends of the segments are intersecting.- Parameters:
x1
- is the first point of the first segment.y1
- is the first point of the first segment.z1
- is the first point of the first segment.x2
- is the second point of the first segment.y2
- is the second point of the first segment.z2
- is the second point of the first segment.x3
- is the first point of the second segment.y3
- is the first point of the second segment.z3
- is the first point of the second segment.x4
- is the second point of the second segment.y4
- is the second point of the second segment.z4
- is the second point of the second segment.- Returns:
- the type of intersection.
- See Also:
intersectsSegmentSegmentWithoutEnds(double, double, double, double, double, double, double, double, double, double, double, double)
-
intersectsSegmentSegmentWithoutEnds
@Pure static boolean intersectsSegmentSegmentWithoutEnds(double x1, double y1, double z1, double x2, double y2, double z2, double x3, double y3, double z3, double x4, double y4, double z4)
Replies if two segments are intersecting. This function considers that the ends of the segments are not intersecting. To include the ends of the segments in the intersection ranges, seeintersectsSegmentSegmentWithEnds(double, double, double, double, double, double, double, double, double, double, double, double)
.- Parameters:
x1
- is the first point of the first segment.y1
- is the first point of the first segment.z1
- is the first point of the first segment.x2
- is the second point of the first segment.y2
- is the second point of the first segment.z2
- is the second point of the first segment.x3
- is the first point of the second segment.y3
- is the first point of the second segment.z3
- is the first point of the second segment.x4
- is the second point of the second segment.y4
- is the second point of the second segment.z4
- is the second point of the second segment.- Returns:
true
if the two shapes are intersecting; otherwisefalse
- See Also:
intersectsSegmentSegmentWithEnds(double, double, double, double, double, double, double, double, double, double, double, double)
-
intersectsSegmentSegmentWithEnds
@Pure static boolean intersectsSegmentSegmentWithEnds(double x1, double y1, double z1, double x2, double y2, double z2, double x3, double y3, double z3, double x4, double y4, double z4)
Replies if two segments are intersecting. This function considers that the ends of the segments are intersecting. To ignore the ends of the segments, seeintersectsSegmentSegmentWithoutEnds(double, double, double, double, double, double, double, double, double, double, double, double)
.- Parameters:
x1
- is the first point of the first segment.y1
- is the first point of the first segment.z1
- is the first point of the first segment.x2
- is the second point of the first segment.y2
- is the second point of the first segment.z2
- is the second point of the first segment.x3
- is the first point of the second segment.y3
- is the first point of the second segment.z3
- is the first point of the second segment.x4
- is the second point of the second segment.y4
- is the second point of the second segment.z4
- is the second point of the second segment.- Returns:
true
if the two shapes are intersecting; otherwisefalse
- See Also:
intersectsSegmentSegmentWithoutEnds(double, double, double, double, double, double, double, double, double, double, double, double)
-
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 Shape3afp<?,?,IE,P,V,B>,IT extends Segment3afp<?,?,IE,P,V,B>,IE extends PathElement3afp,P extends Point3D<? super P,? super V>,V extends Vector3D<? super V,? super P>,B extends RectangularPrism3afp<?,?,IE,P,V,B>>
- Parameters:
shape
- the shape to compare to.- Returns:
true
if this shape is equal is equal to the given path.
-
isEmpty
default boolean isEmpty()
Description copied from interface:Shape3D
Replies if this shape is empty. The semantic associated to the state "empty" depends on the implemented shape. See the subclasses for details.- Specified by:
isEmpty
in interfaceShape3D<ST extends Shape3afp<?,?,IE,P,V,B>,IT extends Segment3afp<?,?,IE,P,V,B>,IE extends PathElement3afp,P extends Point3D<? super P,? super V>,V extends Vector3D<? super V,? super P>,B extends RectangularPrism3afp<?,?,IE,P,V,B>>
- Returns:
true
if the shape is empty;false
otherwise.
-
set
void set(double x1, double y1, double z1, double x2, double y2, double z2)
Change the line.- Parameters:
x1
- x coordinate of the first point.y1
- y coordinate of the first point.z1
- z coordinate of the first point.x2
- x coordinate of the second point.y2
- y coordinate of the second point.z2
- z coordinate of the second point.
-
set
default void set(Point3D<?,?> firstPoint, Point3D<?,?> secondPoint)
Change the line.- Parameters:
firstPoint
- the first point.secondPoint
- the second point.
-
set
default void set(IT shape)
Description copied from interface:Shape3D
Set this shape with the attributes of the given shape.- Specified by:
set
in interfaceShape3D<ST extends Shape3afp<?,?,IE,P,V,B>,IT extends Segment3afp<?,?,IE,P,V,B>,IE extends PathElement3afp,P extends Point3D<? super P,? super V>,V extends Vector3D<? super V,? super P>,B extends RectangularPrism3afp<?,?,IE,P,V,B>>
- Parameters:
shape
- the shape.
-
setX1
void setX1(double x)
Sets a new value in the X of the first point.- Parameters:
x
- the new value double x
-
setY1
void setY1(double y)
Sets a new value in the Y of the first point.- Parameters:
y
- the new value double y
-
setZ1
void setZ1(double z)
Sets a new value in the Z of the first point.- Parameters:
z
- the new value double z
-
setX2
void setX2(double x)
Sets a new value in the X of the second point.- Parameters:
x
- the new value double x
-
setY2
void setY2(double y)
Sets a new value in the Y of the second point.- Parameters:
y
- the new value double y
-
setZ2
void setZ2(double z)
Sets a new value in the Z of the second point.- Parameters:
z
- the new value double z
-
getX1
@Pure double getX1()
Replies the X of the first point.- Returns:
- the x of the first point.
-
getY1
@Pure double getY1()
Replies the Y of the first point.- Returns:
- the y of the first point.
-
getZ1
@Pure double getZ1()
Replies the Z of the first point.- Returns:
- the z of the first point.
-
getX2
@Pure double getX2()
Replies the X of the second point.- Returns:
- the x of the second point.
-
getY2
@Pure double getY2()
Replies the Y of the second point.- Returns:
- the y of the second point.
-
getZ2
@Pure double getZ2()
Replies the Z of the second point.- Returns:
- the z of the second point.
-
getP1
@Pure default P getP1()
Replies the first point.- Returns:
- the first point.
-
getP2
@Pure default P getP2()
Replies the second point.- Returns:
- the second point.
-
setP1
default void setP1(double x, double y, double z)
Change the first point.- Parameters:
x
- x coordinate of the first point.y
- y coordinate of the first point.z
- z coordinate of the first point.
-
setP1
default void setP1(Point3D<?,?> point)
Change the first point.- Parameters:
point
- the first point.
-
setP2
default void setP2(double x, double y, double z)
Change the first point.- Parameters:
x
- x coordinate of the first point.y
- y coordinate of the first point.z
- z coordinate of the first point.
-
setP2
default void setP2(Point3D<?,?> point)
Change the second point.- Parameters:
point
- the second point.
-
getLength
@Pure default double getLength()
Replies the length of the segment.- Returns:
- the length.
-
getLengthSquared
@Pure default double getLengthSquared()
Replies the squared length of the segment.- Returns:
- the squared length.
-
toBoundingBox
@Pure default void toBoundingBox(B box)
Description copied from interface:Shape3D
Replies the bounds of the shape.- Specified by:
toBoundingBox
in interfaceShape3D<ST extends Shape3afp<?,?,IE,P,V,B>,IT extends Segment3afp<?,?,IE,P,V,B>,IE extends PathElement3afp,P extends Point3D<? super P,? super V>,V extends Vector3D<? super V,? super P>,B extends RectangularPrism3afp<?,?,IE,P,V,B>>
- Parameters:
box
- is set with the bounds of the shape.
-
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 Shape3afp<?,?,IE,P,V,B>,IT extends Segment3afp<?,?,IE,P,V,B>,IE extends PathElement3afp,P extends Point3D<? super P,? super V>,V extends Vector3D<? super V,? super P>,B extends RectangularPrism3afp<?,?,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 Shape3afp<?,?,IE,P,V,B>,IT extends Segment3afp<?,?,IE,P,V,B>,IE extends PathElement3afp,P extends Point3D<? super P,? super V>,V extends Vector3D<? super V,? super P>,B extends RectangularPrism3afp<?,?,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 Shape3afp<?,?,IE,P,V,B>,IT extends Segment3afp<?,?,IE,P,V,B>,IE extends PathElement3afp,P extends Point3D<? super P,? super V>,V extends Vector3D<? super V,? super P>,B extends RectangularPrism3afp<?,?,IE,P,V,B>>
- Parameters:
point
- the point.- Returns:
- the distance.
-
contains
default boolean contains(double x, double y, double z)
Replies if the given point is inside this shape.This function uses the equal-to-zero test with the error
Math.ulp(double)
.- Specified by:
contains
in interfaceShape3afp<ST extends Shape3afp<?,?,IE,P,V,B>,IT extends Segment3afp<?,?,IE,P,V,B>,IE extends PathElement3afp,P extends Point3D<? super P,? super V>,V extends Vector3D<? super V,? super P>,B extends RectangularPrism3afp<?,?,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
.- See Also:
MathUtil.isEpsilonZero(double)
-
contains
default boolean contains(RectangularPrism3afp<?,?,?,?,?,?> rectangularPrism)
Description copied from interface:Shape3afp
Replies if the given rectangular prism is inside this shape.- Specified by:
contains
in interfaceShape3afp<ST extends Shape3afp<?,?,IE,P,V,B>,IT extends Segment3afp<?,?,IE,P,V,B>,IE extends PathElement3afp,P extends Point3D<? super P,? super V>,V extends Vector3D<? super V,? super P>,B extends RectangularPrism3afp<?,?,IE,P,V,B>>
- Parameters:
rectangularPrism
- the rectangular prism.- Returns:
true
if the given rectangle is inside this shape, otherwisefalse
.
-
translate
default void translate(double dx, double dy, double dz)
Description copied from interface:Shape3afp
Translate the shape.- Specified by:
translate
in interfaceShape3afp<ST extends Shape3afp<?,?,IE,P,V,B>,IT extends Segment3afp<?,?,IE,P,V,B>,IE extends PathElement3afp,P extends Point3D<? super P,? super V>,V extends Vector3D<? super V,? super P>,B extends RectangularPrism3afp<?,?,IE,P,V,B>>
- Parameters:
dx
- x translation.dy
- y translation.dz
- z translation.
-
transform
default void transform(Transform3D transform)
Transform the current segment. This function changes the current segment.- Parameters:
transform
- is the affine transformation to apply.- See Also:
Shape3afp.createTransformedShape(org.arakhne.afc.math.geometry.d3.Transform3D)
-
clear
default void clear()
Description copied from interface:Shape3D
Reset this shape to be equivalent to an just-created instance of this shape type.
-
clipToRectangle
@Pure default boolean clipToRectangle(double rxmin, double rymin, double rzmin, double rxmax, double rymax, double rzmax)
Clip the segment against the clipping rectangle according to the Cohen-Sutherland algorithm.- Parameters:
rxmin
- is the min of the coordinates of the rectangle.rymin
- is the min of the coordinates of the rectangle.rzmin
- is the min of the coordinates of the rectangle.rxmax
- is the max of the coordinates of the rectangle.rymax
- is the max of the coordinates of the rectangle.rzmax
- is the max of the coordinates of the rectangle.- Returns:
true
if the segment has an intersection with the rectangle and the segment was clipped;false
if the segment does not intersect the rectangle.
-
intersects
@Pure default boolean intersects(Sphere3afp<?,?,?,?,?,?> sphere)
Description copied from interface:Shape3afp
Replies if this shape is intersecting the given circle.- Specified by:
intersects
in interfaceShape3afp<ST extends Shape3afp<?,?,IE,P,V,B>,IT extends Segment3afp<?,?,IE,P,V,B>,IE extends PathElement3afp,P extends Point3D<? super P,? super V>,V extends Vector3D<? super V,? super P>,B extends RectangularPrism3afp<?,?,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(RectangularPrism3afp<?,?,?,?,?,?> prism)
Description copied from interface:Shape3afp
Replies if this shape is intersecting the given Prism.- Specified by:
intersects
in interfaceShape3afp<ST extends Shape3afp<?,?,IE,P,V,B>,IT extends Segment3afp<?,?,IE,P,V,B>,IE extends PathElement3afp,P extends Point3D<? super P,? super V>,V extends Vector3D<? super V,? super P>,B extends RectangularPrism3afp<?,?,IE,P,V,B>>
- Parameters:
prism
- the prism- Returns:
true
if this shape is intersecting the given shape;false
if there is no intersection.
-
intersects
@Pure default boolean intersects(Segment3afp<?,?,?,?,?,?> segment)
Description copied from interface:Shape3afp
Replies if this shape is intersecting the given line.- Specified by:
intersects
in interfaceShape3afp<ST extends Shape3afp<?,?,IE,P,V,B>,IT extends Segment3afp<?,?,IE,P,V,B>,IE extends PathElement3afp,P extends Point3D<? super P,? super V>,V extends Vector3D<? super V,? super P>,B extends RectangularPrism3afp<?,?,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
@Pure default boolean intersects(PathIterator3afp<?> iterator)
Description copied from interface:Shape3afp
Replies if this shape is intersecting the shape representing the given path iterator.- Specified by:
intersects
in interfaceShape3afp<ST extends Shape3afp<?,?,IE,P,V,B>,IT extends Segment3afp<?,?,IE,P,V,B>,IE extends PathElement3afp,P extends Point3D<? super P,? super V>,V extends Vector3D<? super V,? super P>,B extends RectangularPrism3afp<?,?,IE,P,V,B>>
- Parameters:
iterator
- the iterator- Returns:
true
if this shape is intersecting the given shape;false
if there is no intersection.
-
intersects
@Pure default boolean intersects(MultiShape3afp<?,?,?,?,?,?,?> multishape)
Description copied from interface:Shape3afp
Replies if this shape is intersecting the given multishape.- Specified by:
intersects
in interfaceShape3afp<ST extends Shape3afp<?,?,IE,P,V,B>,IT extends Segment3afp<?,?,IE,P,V,B>,IE extends PathElement3afp,P extends Point3D<? super P,? super V>,V extends Vector3D<? super V,? super P>,B extends RectangularPrism3afp<?,?,IE,P,V,B>>
- Parameters:
multishape
- the multishape- Returns:
true
if this shape is intersecting the given shape;false
if there is no intersection.
-
getPathIterator
@Pure default PathIterator3afp<IE> getPathIterator(Transform3D transform)
Description copied from interface:Shape3D
Replies the elements of the paths.- Specified by:
getPathIterator
in interfaceShape3D<ST extends Shape3afp<?,?,IE,P,V,B>,IT extends Segment3afp<?,?,IE,P,V,B>,IE extends PathElement3afp,P extends Point3D<? super P,? super V>,V extends Vector3D<? super V,? super P>,B extends RectangularPrism3afp<?,?,IE,P,V,B>>
- Parameters:
transform
- is the transformation to apply to the path.- Returns:
- the elements of the path.
-
getClosestPointTo
@Pure 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 Shape3afp<?,?,IE,P,V,B>,IT extends Segment3afp<?,?,IE,P,V,B>,IE extends PathElement3afp,P extends Point3D<? super P,? super V>,V extends Vector3D<? super V,? super P>,B extends RectangularPrism3afp<?,?,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
@Pure default P getClosestPointTo(Sphere3afp<?,?,?,?,?,?> sphere)
Description copied from interface:Shape3afp
Replies the closest point on this shape to the given sphere.If the two shapes are intersecting, the replied point is always at the intersection of the two shapes. This function does not enforce the meaning of the replied point in the case of shape intersection. In other words, this function is warranting that the reply point is the either the penetration point, nor a perimeter point, nor any point with a specific meaning.
- Specified by:
getClosestPointTo
in interfaceShape3afp<ST extends Shape3afp<?,?,IE,P,V,B>,IT extends Segment3afp<?,?,IE,P,V,B>,IE extends PathElement3afp,P extends Point3D<? super P,? super V>,V extends Vector3D<? super V,? super P>,B extends RectangularPrism3afp<?,?,IE,P,V,B>>
- Parameters:
sphere
- the sphere.- Returns:
- the closest point on the shape; or the point itself if it is inside the shape.
-
getClosestPointTo
default P getClosestPointTo(Path3afp<?,?,?,?,?,?> path)
Description copied from interface:Shape3afp
Replies the closest point on this shape to the given path.If the two shapes are intersecting, the replied point is always at the intersection of the two shapes. This function does not enforce the meaning of the replied point in the case of shape intersection. In other words, this function is warranting that the reply point is the either the penetration point, nor a perimeter point, nor any point with a specific meaning.
- Specified by:
getClosestPointTo
in interfaceShape3afp<ST extends Shape3afp<?,?,IE,P,V,B>,IT extends Segment3afp<?,?,IE,P,V,B>,IE extends PathElement3afp,P extends Point3D<? super P,? super V>,V extends Vector3D<? super V,? super P>,B extends RectangularPrism3afp<?,?,IE,P,V,B>>
- Parameters:
path
- the path.- Returns:
- the closest point on the shape; or the point itself if it is inside the shape.
-
getClosestPointTo
@Pure default P getClosestPointTo(RectangularPrism3afp<?,?,?,?,?,?> rectangle)
Description copied from interface:Shape3afp
Replies the closest point on this shape to the given rectangular prism.If the two shapes are intersecting, the replied point is always at the intersection of the two shapes. This function does not enforce the meaning of the replied point in the case of shape intersection. In other words, this function is warranting that the reply point is the either the penetration point, nor a perimeter point, nor any point with a specific meaning.
- Specified by:
getClosestPointTo
in interfaceShape3afp<ST extends Shape3afp<?,?,IE,P,V,B>,IT extends Segment3afp<?,?,IE,P,V,B>,IE extends PathElement3afp,P extends Point3D<? super P,? super V>,V extends Vector3D<? super V,? super P>,B extends RectangularPrism3afp<?,?,IE,P,V,B>>
- Parameters:
rectangle
- the rectangular prism.- Returns:
- the closest point on the shape; or the point itself if it is inside the shape.
-
getClosestPointTo
@Pure default P getClosestPointTo(Segment3afp<?,?,?,?,?,?> segment)
Description copied from interface:Shape3afp
Replies the closest point on this shape to the given segment.If the two shapes are intersecting, the replied point is always at the intersection of the two shapes. This function does not enforce the meaning of the replied point in the case of shape intersection. In other words, this function is warranting that the reply point is the either the penetration point, nor a perimeter point, nor any point with a specific meaning.
- Specified by:
getClosestPointTo
in interfaceShape3afp<ST extends Shape3afp<?,?,IE,P,V,B>,IT extends Segment3afp<?,?,IE,P,V,B>,IE extends PathElement3afp,P extends Point3D<? super P,? super V>,V extends Vector3D<? super V,? super P>,B extends RectangularPrism3afp<?,?,IE,P,V,B>>
- Parameters:
segment
- the segment.- Returns:
- the closest point on the shape; or the point itself if it is inside the shape.
-
getFarthestPointTo
@Pure 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 Shape3afp<?,?,IE,P,V,B>,IT extends Segment3afp<?,?,IE,P,V,B>,IE extends PathElement3afp,P extends Point3D<? super P,? super V>,V extends Vector3D<? super V,? super P>,B extends RectangularPrism3afp<?,?,IE,P,V,B>>
- Parameters:
pt
- the point.- Returns:
- the farthest point on the shape.
-
-