public class TLcdCartesian extends Object
Constructor and Description |
---|
TLcdCartesian() |
Modifier and Type | Method and Description |
---|---|
static boolean |
arcContains2D(double aCenterX,
double aCenterY,
double aMajorAxis,
double aMinorAxis,
double aRotAngle,
double aStartAngle,
double aArcAngle,
double aX,
double aY)
Returns whether a point lies on the elliptical arc segment.
|
static double |
area(ILcdPoint[] aPts,
int aN)
Surface area of a polygon given with cartesian coordinates.
|
static double |
area(ILcdShape aShape)
Calculates the geodesic area of a shape.
|
static boolean |
areCollinear2D(double aX1,
double aY1,
double aX2,
double aY2,
double aX3,
double aY3)
Checks whether the points with the given coordinates are collinear, which means they lie on a single line.
|
static boolean |
areCollinear2D(ILcdPoint aP1,
ILcdPoint aP2,
ILcdPoint aP3)
Checks whether the given points are collinear, which means they lie on a single line.
|
static void |
bufferContour2DOf2DPolyline(ILcdPointList aPointList,
double aWidth,
double aRadius,
ILcd2DEditablePoint[] a2DEditablePointArraySFCT)
Deprecated.
Use
bufferContour2DOf2DPolyline without the aRadius parameter instead. |
static void |
bufferContour2DOf2DPolyline(ILcdPointList aPointList,
double aWidth,
ILcd2DEditablePoint[] a2DEditablePointArraySFCT)
Calculates the contour of the buffer/corridor along a given
ILcd2DEditablePolyline at a given width. |
static void |
bufferContour2DOfSegmentSFCT(ILcdPoint aStartPoint,
ILcdPoint aEndPoint,
double aWidth,
ILcd2DEditablePoint[] a2DEditablePointArraySFCT)
Calculates the contour of the rectangle defined by
aStartPoint , aEndPoint , and aWidth ,
as an array of ILcd2DEditablePoint objects. |
static void |
cartesianPointSFCT(ILcdPoint aPoint,
double aDistance,
double aAzimuth,
ILcd2DEditablePoint aPointSFCT)
Determines the point on the cartesian line through
(aP1.getX(), aP1.getY()) located at a
distance aDistance and forward azimuth aAzimuth . |
static void |
cartesianPointSFCT(ILcdPoint aP1,
ILcdPoint aP2,
double aFraction,
ILcd3DEditablePoint aPointSFCT)
Interpolates linearly between the two given points.
|
static double |
closestPointOnLineSegment(double aX0,
double aY0,
double aX1,
double aY1,
double aX2,
double aY2,
ILcd2DEditablePoint aClosestPointSFCT)
Calculates the closest point on a line segment
(aX0,aY0)-(aX1,aY1)
from a point (aX2,aY2) . |
static double |
closestPointOnLineSegment(ILcdPoint aP0,
ILcdPoint aP1,
ILcdPoint aP2,
ILcd2DEditablePoint aClosestPointSFCT)
Calculates the closest point on a line segment
aP0-aP1
from a point aP2 . |
static double |
closestPointOnShape(ILcdPoint aPoint,
ILcdShape aShape,
ILcd2DEditablePoint aResultSFCT)
Finds the shortest cartesian distance from the given point to the given shape.
|
static ILcdComplexPolygon |
computeBufferContour2D(ILcdGeoBuffer aBuffer)
Calculates the contour of an
ILcdGeoBuffer in the cartesian space. |
static boolean |
computeInsidePoint(ILcdPointList aPointList,
ILcd2DEditablePoint aInsidePointSFCT)
Computes a point in the interior of the polygon defined by the given point list.
|
static boolean |
computeInsidePoint(ILcdPointList aPointList,
List<? extends ILcdPointList> aExcludedPointLists,
ILcd2DEditablePoint aInsidePointSFCT)
Computes a point in the interior of the polygon defined by the given point list.
|
static boolean |
contains2D(double aX1,
double aY1,
double aX2,
double aY2,
double aXP,
double aYP)
Calculates whether a point lies on a given line segment.
|
static boolean |
contains2DLS(double aX1,
double aY1,
double aX2,
double aY2,
double aX3,
double aY3,
double aX4,
double aY4)
Calculates whether line segment
(aX1,aY1)-(aX2,aY2) contains
the line segment (aX3,aY3)-(aX4,aY4) . |
static boolean |
contains2DSR(double aX1,
double aY1,
double aWidth1,
double aHeight1,
double aX2,
double aY2,
double aWidth2,
double aHeight2)
Checks whether a 2D rectangle contains another rectangle.
|
static boolean |
contains3D(double aX1,
double aY1,
double aZ1,
double aX2,
double aY2,
double aZ2,
double aXP,
double aYP,
double aZP)
Calculates whether a point lies on a given line segment taking into account
3 coordinates.
|
static boolean |
containsAngle(double aStartAngle,
double aArcAngle,
double aTargetAngle)
Checks whether the angle
aTargetAngle lies within the
arc segment starting at aStartAngle extending over
aArcAngle . |
static void |
contour2DOfBoundsSFCT(ILcdBounds aBounds,
ILcd2DEditablePoint[] a2DEditablePointArraySFCT)
Calculates the contour of the given
ILcdBounds ,
as an array of ILcd2DEditablePoint objects. |
static double |
distance2D(double aX1,
double aY1,
double aX2,
double aY2)
Calculates the distance between two cartesian points
(aX1,aY1)
and (aX2,aY2) . |
static double |
distance2D(ILcdPoint aP1,
ILcdPoint aP2)
Calculates the distance between two
ILcdPoint objects
aP1 and aP2 . |
static double |
distance3D(double aX1,
double aY1,
double aZ1,
double aX2,
double aY2,
double aZ2)
Calculates the distance between two cartesian points
(aX1,aY1,aZ1)
and (aX2,aY2,aZ2) . |
static double |
distance3D(ILcdPoint aP1,
ILcdPoint aP2)
Calculates the distance between two
ILcdPoint objects
aP1 and aP2 . |
static boolean |
ellipseContains2D(double aCenterX,
double aCenterY,
double aMajorAxis,
double aMinorAxis,
double aRotAngle,
double aX,
double aY)
Returns whether a point lies within an ellipse.
|
static void |
elliptical2DPointSFCT(double aA,
double aB,
double aAngle,
ILcd2DEditablePoint a2DEditablePointSFCT)
Calculates an
ILcd2DEditablePoint on an ellipse with
semi-major axis aA and semi-minor axis aB
and an aAngle from the semi-major axis measured in degrees,
positive COUNTERCLOCKWISE. |
static double |
ellipticalDistance2D(double aA,
double aB,
double aAngle)
Calculates the cartesian distance between the center of an ellipse
with semi-major axis
aA and semi-minor axis aB
and a point located on the ellipse at an aAngle from the
semi-major axis measured in degrees positive COUNTERCLOCKWISE. |
static double |
forwardAngle2D(double aX1,
double aY1,
double aX2,
double aY2)
Forward angle from
(aX1,aY1) to (aX2,aY2) in RADIANS!
The resulting value lies between [-Math.PI, Math.PI]. |
static double |
forwardAngle2D(ILcdPoint aP1,
ILcdPoint aP2)
Forward angle from
aP1 to aP2 in RADIANS!
The resulting value lies between [-Math.PI, Math.PI]. |
static double |
forwardAzimuth2D(double aX1,
double aY1,
double aX2,
double aY2)
Forward azimuth from
(aX1,aY1) to (aX2,aY2) in RADIANS!
The resulting value lies between [0.0, 2.0*Math.PI]. |
static double |
forwardAzimuth2D(ILcdPoint aP1,
ILcdPoint aP2)
Forward azimuth from
aP1 to aP2 in RADIANS!
The resulting value lies between [0.0, 2.0*Math.PI]. |
static int |
intersection2DLines(double aX1,
double aY1,
double aX2,
double aY2,
double aX3,
double aY3,
double aX4,
double aY4,
ILcd2DEditablePoint aResultSFCT)
Calculates the intersection point between the line going through
P1(aX1,aY1) and P2(aX2,aY2) , and
the line going through P3(aX3,aY3) and P4(aX4,aY4) . |
static int |
intersection2DLines(ILcdPoint aP1,
ILcdPoint aP2,
ILcdPoint aP3,
ILcdPoint aP4,
ILcd2DEditablePoint aResultSFCT)
Calculates the intersection point between the line going through
aP1 and aP2 , and the line going
through aP3 and aP4 . |
static int |
intersection2DLineSegments(double aX1,
double aY1,
double aX2,
double aY2,
double aX3,
double aY3,
double aX4,
double aY4,
ILcd2DEditablePoint aResult1SFCT,
ILcd2DEditablePoint aResult2SFCT)
Calculates the intersection point between the line segments
P1(aX1,aY1)-P2(aX2,aY2) and
P3(aX3,aY3)-P4(aX4,aY4) , if it exists. |
static int |
intersection2DLineSegments(ILcdPoint aP1,
ILcdPoint aP2,
ILcdPoint aP3,
ILcdPoint aP4,
ILcd2DEditablePoint aResult1SFCT,
ILcd2DEditablePoint aResult2SFCT)
Calculates the intersection point between the line segments
P1(aX1,aY1)-P2(aX2,aY2) and
P3(aX3,aY3)-P4(aX4,aY4) , if it exists. |
static void |
intersection2DLSSFCT(double aX1,
double aY1,
double aX2,
double aY2,
double aX3,
double aY3,
double aX4,
double aY4,
ILcd2DEditablePoint a2DEditablePoint)
Deprecated.
Use
intersection2DLines(com.luciad.shape.ILcdPoint, com.luciad.shape.ILcdPoint, com.luciad.shape.ILcdPoint, com.luciad.shape.ILcdPoint, com.luciad.shape.shape2D.ILcd2DEditablePoint) for calculating the intersection point between two lines, or
intersection2DLineSegments(com.luciad.shape.ILcdPoint, com.luciad.shape.ILcdPoint, com.luciad.shape.ILcdPoint, com.luciad.shape.ILcdPoint, com.luciad.shape.shape2D.ILcd2DEditablePoint, com.luciad.shape.shape2D.ILcd2DEditablePoint) for the intersection point of two line segments. |
static void |
intersection2DLSSFCT(ILcdPoint aP1,
ILcdPoint aP2,
ILcdPoint aP3,
ILcdPoint aP4,
ILcd2DEditablePoint a2DEditablePoint)
Deprecated.
Use
intersection2DLines(com.luciad.shape.ILcdPoint, com.luciad.shape.ILcdPoint, com.luciad.shape.ILcdPoint, com.luciad.shape.ILcdPoint, com.luciad.shape.shape2D.ILcd2DEditablePoint) for calculating the intersection point of two lines, or
intersection2DLineSegments(com.luciad.shape.ILcdPoint, com.luciad.shape.ILcdPoint, com.luciad.shape.ILcdPoint, com.luciad.shape.ILcdPoint, com.luciad.shape.shape2D.ILcd2DEditablePoint, com.luciad.shape.shape2D.ILcd2DEditablePoint) for the intersection point of two line segments. |
static boolean |
intersects2DLS(double aX1,
double aY1,
double aX2,
double aY2,
double aX3,
double aY3,
double aX4,
double aY4)
Checks whether line segment
P1(aX1,aY1)-P2(aX2,aY2)
intersects or overlaps line segment P3(aX3,aY3)-P4(aX4,aY4) . |
static boolean |
intersects2DLS(ILcdPoint aP1,
ILcdPoint aP2,
ILcdPoint aP3,
ILcdPoint aP4)
Check whether line segment
aP1-aP2 and line segment
aP3-aP4 intersect each other. |
static boolean |
intersects2DSR(double aX1,
double aY1,
double aWidth1,
double aHeight1,
double aX2,
double aY2,
double aWidth2,
double aHeight2)
Checks whether two 2D rectangles intersect.
|
static boolean |
intersectsCircularArcWithCircularArc(double aX1,
double aY1,
double aRadius1,
double aStartAngle1,
double aArcAngle1,
double aX2,
double aY2,
double aRadius2,
double aStartAngle2,
double aArcAngle2)
Returns whether the two circular arc segments intersect each other.
|
static boolean |
intersectsLSWithCircularArc(double aX1,
double aY1,
double aX2,
double aY2,
double aXCenter,
double aYCenter,
double aRadius,
double aStartAngle,
double aArcAngle)
Returns whether the line segment and the circular arc have an intersection.
|
static double |
normalizeAngle(double aAngle)
Normalizes
aAngle to the interval ]-180, 180]. |
static int |
orientation2D(ILcdPoint[] aPts,
int aN)
Calculate the orientation of a polygon of points.
|
static int |
orientation2D(ILcdPointList aPointList)
Calculate the orientation of a polygon of points.
|
static boolean |
overlaps2DSR(double aX1,
double aY1,
double aWidth1,
double aHeight1,
double aX2,
double aY2,
double aWidth2,
double aHeight2)
Checks whether two 2D rectangles overlap.
|
static boolean |
overlaps2DSRLowLeft(double aX1,
double aY1,
double aWidth1,
double aHeight1,
double aX2,
double aY2,
double aWidth2,
double aHeight2)
Checks whether two 2D rectangles overlap.
|
static boolean |
parallel2DLS(double aX1,
double aY1,
double aX2,
double aY2,
double aX3,
double aY3,
double aX4,
double aY4)
Checks whether line segment
P1(aX1,aY1)-P2(aX2,aY2)
is parallel with line segment P3(aX3,aY3)-P4(aX4,aY4) . |
static boolean |
rectangleContains2D(double aX,
double aY,
double aStartPointX,
double aStartPointY,
double aEndPointX,
double aEndPointY,
double aWidth)
Checks whether the rectangle contains the 2D point
aX,aY . |
static boolean |
simpleRectangleContains2D(double aX,
double aY,
double aPointX,
double aPointY,
double aWidth,
double aHeight)
Checks whether the 2D rectangle defined by the point
(aPointX,aPointY) , the width aWidth , and the
height aHeight contains the 2D point (aX,aY) . |
static double |
squaredDistance2D(double aX1,
double aY1,
double aX2,
double aY2)
Calculates the squared distance between two cartesian points
(aX1,aY1)
and (aX2,aY2) . |
static double |
squaredDistance2D(ILcdPoint aP1,
ILcdPoint aP2)
Calculates the squared distance between two
ILcdPoint objects
aP1 and aP2 . |
static double |
squaredDistance3D(double aX1,
double aY1,
double aZ1,
double aX2,
double aY2,
double aZ2)
Calculates the squared distance between two cartesian points
(aX1,aY1,aZ1)
and (aX2,aY2,aZ2) . |
static double |
squaredDistance3D(ILcdPoint aP1,
ILcdPoint aP2)
Calculates the squared distance between two
ILcdPoint objects
aP1 and aP2 . |
public static double distance2D(ILcdPoint aP1, ILcdPoint aP2)
ILcdPoint
objects
aP1
and aP2
.aP1
- first point.aP2
- second point.aP1
and aP2
.public static double squaredDistance2D(ILcdPoint aP1, ILcdPoint aP2)
ILcdPoint
objects
aP1
and aP2
.aP1
- first point.aP2
- second point.aP1
and aP2
.public static double distance2D(double aX1, double aY1, double aX2, double aY2)
(aX1,aY1)
and (aX2,aY2)
.aX1
- x-coordinate of the first point.aY1
- y-coordinate of the first point.aX2
- x-coordinate of the second point.aY2
- y-coordinate of the second point.(aX1,aY1)
and (aX2,aY2)
.public static double squaredDistance2D(double aX1, double aY1, double aX2, double aY2)
(aX1,aY1)
and (aX2,aY2)
.aX1
- x-coordinate of the first point.aY1
- y-coordinate of the first point.aX2
- x-coordinate of the second point.aY2
- y-coordinate of the second point.(aX1,aY1)
and (aX2,aY2)
.public static double distance3D(ILcdPoint aP1, ILcdPoint aP2)
ILcdPoint
objects
aP1
and aP2
.aP1
- first point.aP2
- second point.aP1
and aP2
.public static double squaredDistance3D(ILcdPoint aP1, ILcdPoint aP2)
ILcdPoint
objects
aP1
and aP2
.aP1
- first point.aP2
- second point.aP1
and aP2
.public static double distance3D(double aX1, double aY1, double aZ1, double aX2, double aY2, double aZ2)
(aX1,aY1,aZ1)
and (aX2,aY2,aZ2)
.aX1
- x-coordinate of the first point.aY1
- y-coordinate of the first point.aZ1
- z-coordinate of the first point.aX2
- x-coordinate of the second point.aY2
- y-coordinate of the second point.aZ2
- z-coordinate of the second point.(aX1,aY1,aZ1)
and (aX2,aY2,aZ2)
.public static double squaredDistance3D(double aX1, double aY1, double aZ1, double aX2, double aY2, double aZ2)
(aX1,aY1,aZ1)
and (aX2,aY2,aZ2)
.aX1
- x-coordinate of the first point.aY1
- y-coordinate of the first point.aZ1
- z-coordinate of the first point.aX2
- x-coordinate of the second point.aY2
- y-coordinate of the second point.aZ2
- z-coordinate of the second point.(aX1,aY1,aZ1)
and (aX2,aY2,aZ2)
.public static double area(ILcdPoint[] aPts, int aN)
Constraints: aN > 2
and aPts.length ≥ aN
aPts
- array of ILcdPoint
objects.aN
- aPts[0..aN-1]
defines the polygon.public static double area(ILcdShape aShape)
Following shapes are supported:
ILcdPolygon
that doesn't self-intersectILcdComplexPolygon
that is geometrically valid: no individual polygon can be self-intersecting, and
no two polygons may intersect. Nested polygons are allowed.ILcdSurface
with external and internal rings as polygons. The surface must also be geometrically
valid.ILcdShapeList
containing supported shapes.
This method does not fully check the validity of the arguments, since it is computationally too expensive to do so.
Passing an unsupported shape may result in an IllegalArgumentException
being thrown, or may result in an
undefined return value.
aShape
- a shape adhering to the requirements aboveTLcdEllipsoidUtil.geodesicArea(ILcdShape, ILcdEllipsoid)
,
TLcdSphereUtil.geodesicArea(ILcdShape, double)
public static double forwardAzimuth2D(ILcdPoint aP1, ILcdPoint aP2)
aP1
to aP2
in RADIANS!
The resulting value lies between [0.0, 2.0*Math.PI].
Forward azimuth is the angle between the Y-axis and the line from
aP1
to aP2
.
Measured positive CLOCKWISE!aP1
- start point.aP2
- end point.public static double forwardAzimuth2D(double aX1, double aY1, double aX2, double aY2)
(aX1,aY1)
to (aX2,aY2)
in RADIANS!
The resulting value lies between [0.0, 2.0*Math.PI].
Forward azimuth is the angle between the Y-axis and the line from
(aX1,aY1)
to (aX2,aY2)
.
Measured positive CLOCKWISE!aX1
- x-coordinate of the start point.aY1
- y-coordinate of the start point.aX2
- x-coordinate of the end point.aY2
- y-coordinate of the end point.public static double forwardAngle2D(ILcdPoint aP1, ILcdPoint aP2)
aP1
to aP2
in RADIANS!
The resulting value lies between [-Math.PI, Math.PI].
Forward angle is the angle between the Y-axis and the line from
aP1
to aP2
.
Measured positive CLOCKWISE!aP1
- start point.aP2
- end point.public static double forwardAngle2D(double aX1, double aY1, double aX2, double aY2)
(aX1,aY1)
to (aX2,aY2)
in RADIANS!
The resulting value lies between [-Math.PI, Math.PI].
Forward angle is the angle between the Y-axis and the line from
(aX1,aY1)
to (aX2,aY2)
.
Measured positive CLOCKWISE!aX1
- x-coordinate of the start point.aY1
- y-coordinate of the start point.aX2
- x-coordinate of the end point.aY2
- y-coordinate of the end point.public static int orientation2D(ILcdPoint[] aPts, int aN)
Constraints: aN > 2
and aPts.length ≥ aN
aPts
- array of ILcd2DEditablePoint
objects (first point is not repeated)!aN
- aPts[0..aN-1]
number of points.public static int orientation2D(ILcdPointList aPointList)
Constraints: aN > 2
and aPts.length ≥ aN
aPointList
- polygon (first point is not repeated)!ILcdPolygon.CLOCKWISE
or
ILcdPolygon.COUNTERCLOCKWISE
.public static void elliptical2DPointSFCT(double aA, double aB, double aAngle, ILcd2DEditablePoint a2DEditablePointSFCT)
ILcd2DEditablePoint
on an ellipse with
semi-major axis aA
and semi-minor axis aB
and an aAngle
from the semi-major axis measured in degrees,
positive COUNTERCLOCKWISE.
The line with angle aAlpha
starts from the center of the
ellipse.aA
- semi-major axis of the ellipse.aB
- semi-minor axis of the ellipse.aAngle
- angle from the semi-major axis, measured in degrees, positive COUNTERCLOCKWISE.a2DEditablePointSFCT
- the resulting point as side effect.public static double ellipticalDistance2D(double aA, double aB, double aAngle)
aA
and semi-minor axis aB
and a point located on the ellipse at an aAngle
from the
semi-major axis measured in degrees positive COUNTERCLOCKWISE.aA
- semi-major axis of the ellipse.aB
- semi-minor axis of the ellipse.aAngle
- angle from the semi-major axis, measured in degrees, positive COUNTERCLOCKWISE.aA
and semi-minor axis aB
and a point located on the ellipse at an aAngle
from the
semi-major axis measured in degrees positive COUNTERCLOCKWISE.public static double closestPointOnShape(ILcdPoint aPoint, ILcdShape aShape, ILcd2DEditablePoint aResultSFCT)
This methods supports linear
ILcdPolyline
and ILcdPolygon
instances.
aPoint
- the starting pointaShape
- the shape for which to find the point closest to aPointaResultSFCT
- side-effect parameter for the resulting pointIllegalArgumentException
- if the provided shape is not supportedpublic static double closestPointOnLineSegment(ILcdPoint aP0, ILcdPoint aP1, ILcdPoint aP2, ILcd2DEditablePoint aClosestPointSFCT)
aP0-aP1
from a point aP2
. The distance between the points aP2
and this closest point is returned as a result.
The coordinates of the closest point are available within the side effect
parameter aClosestPointSFCT
.aP0
- an end point of the line segment.aP1
- an end point of the line segment.aP2
- point from which to search the closest point on the line segment.aClosestPointSFCT
- the closest point on the line segment as side effect.public static double closestPointOnLineSegment(double aX0, double aY0, double aX1, double aY1, double aX2, double aY2, ILcd2DEditablePoint aClosestPointSFCT)
(aX0,aY0)-(aX1,aY1)
from a point (aX2,aY2)
. The distance between the points
(aX2,aY2)
and this closest point is returned as a result.
The coordinates of the closest point are available within the side effect
parameter aClosestPointSFCT
.aX0
- x-coordinate of the first end point of the line segment.aY0
- y-coordinate of the first end point of the line segment.aX1
- x-coordinate of the second end point of the line segment.aY1
- y-coordinate of the second end point of the line segment.aX2
- x-coordinate of the point from which to search for the closest point on the line segment.aY2
- y-coordinate of the point from which to search for the closest point on the line segment.aClosestPointSFCT
- the closest point on the line segment as side effect.public static boolean intersects2DLS(ILcdPoint aP1, ILcdPoint aP2, ILcdPoint aP3, ILcdPoint aP4)
aP1-aP2
and line segment
aP3-aP4
intersect each other.aP1
- an end point of the first line segment.aP2
- an end point of the first line segment.aP3
- an end point of the second line segment.aP4
- an end point of the second line segment.true
if they have an intersection point, false
otherwise.public static boolean intersects2DLS(double aX1, double aY1, double aX2, double aY2, double aX3, double aY3, double aX4, double aY4)
P1(aX1,aY1)-P2(aX2,aY2)
intersects or overlaps line segment P3(aX3,aY3)-P4(aX4,aY4)
.aX1
- x-coordinate of an end point of the first line segment.aY1
- y-coordinate of an end point of the first line segment.aX2
- x-coordinate of an end point of the first line segment.aY2
- y-coordinate of an end point of the first line segment.aX3
- x-coordinate of an end point of the second line segment.aY3
- y-coordinate of an end point of the second line segment.aX4
- x-coordinate of an end point of the second line segment.aY4
- y-coordinate of an end point of the second line segment.true
if they have an intersection point or overlap, false
otherwise.public static boolean parallel2DLS(double aX1, double aY1, double aX2, double aY2, double aX3, double aY3, double aX4, double aY4)
P1(aX1,aY1)-P2(aX2,aY2)
is parallel with line segment P3(aX3,aY3)-P4(aX4,aY4)
.aX1
- x-coordinate of an end point of the first line segment.aY1
- y-coordinate of an end point of the first line segment.aX2
- x-coordinate of an end point of the first line segment.aY2
- y-coordinate of an end point of the first line segment.aX3
- x-coordinate of an end point of the second line segment.aY3
- y-coordinate of an end point of the second line segment.aX4
- x-coordinate of an end point of the second line segment.aY4
- y-coordinate of an end point of the second line segment.true
if the line segments are parallel, false
otherwise.public static boolean intersectsLSWithCircularArc(double aX1, double aY1, double aX2, double aY2, double aXCenter, double aYCenter, double aRadius, double aStartAngle, double aArcAngle)
aX1
- x-coordinate of the first end point of the line segment.aY1
- y-coordinate of the first end point of the line segment.aX2
- x-coordinate of the second end point of the line segment.aY2
- y-coordinate of the second end point of the line segment.aXCenter
- x-coordinate of the center of the circular arc.aYCenter
- y-coordinate of the center of the circular arc.aRadius
- radius of the circular arc.aStartAngle
- start angle of the circular arc segment in decimal degrees.aArcAngle
- extent of the arc segment in decimal degrees.public static boolean intersectsCircularArcWithCircularArc(double aX1, double aY1, double aRadius1, double aStartAngle1, double aArcAngle1, double aX2, double aY2, double aRadius2, double aStartAngle2, double aArcAngle2)
aX1
- x-coordinate of the center of the circular arc.aY1
- y-coordinate of the center of the circular arc.aRadius1
- radius of the circular arc.aStartAngle1
- start angle of the circular arc segment in decimal degrees.aArcAngle1
- extent of the arc segment in decimal degrees.aX2
- x-coordinate of the center of the circular arc.aY2
- y-coordinate of the center of the circular arc.aRadius2
- radius of the circular arc.aStartAngle2
- start angle of the circular arc segment in decimal degrees.aArcAngle2
- extent of the arc segment in decimal degrees.@Deprecated public static void intersection2DLSSFCT(ILcdPoint aP1, ILcdPoint aP2, ILcdPoint aP3, ILcdPoint aP4, ILcd2DEditablePoint a2DEditablePoint)
intersection2DLines(com.luciad.shape.ILcdPoint, com.luciad.shape.ILcdPoint, com.luciad.shape.ILcdPoint, com.luciad.shape.ILcdPoint, com.luciad.shape.shape2D.ILcd2DEditablePoint)
for calculating the intersection point of two lines, or
intersection2DLineSegments(com.luciad.shape.ILcdPoint, com.luciad.shape.ILcdPoint, com.luciad.shape.ILcdPoint, com.luciad.shape.ILcdPoint, com.luciad.shape.shape2D.ILcd2DEditablePoint, com.luciad.shape.shape2D.ILcd2DEditablePoint)
for the intersection point of two line segments.aP1-aP2
and aP3-aP4
.aP1
- an end point of the first line segment.aP2
- an end point of the first line segment.aP3
- an end point of the second line segment.aP4
- an end point of the second line segment.a2DEditablePoint
- the intersection point of the two line segments as side effect.@Deprecated public static void intersection2DLSSFCT(double aX1, double aY1, double aX2, double aY2, double aX3, double aY3, double aX4, double aY4, ILcd2DEditablePoint a2DEditablePoint)
intersection2DLines(com.luciad.shape.ILcdPoint, com.luciad.shape.ILcdPoint, com.luciad.shape.ILcdPoint, com.luciad.shape.ILcdPoint, com.luciad.shape.shape2D.ILcd2DEditablePoint)
for calculating the intersection point between two lines, or
intersection2DLineSegments(com.luciad.shape.ILcdPoint, com.luciad.shape.ILcdPoint, com.luciad.shape.ILcdPoint, com.luciad.shape.ILcdPoint, com.luciad.shape.shape2D.ILcd2DEditablePoint, com.luciad.shape.shape2D.ILcd2DEditablePoint)
for the intersection point of two line segments.P1(aX1,aY1)-P2(aX2,aY2)
and
P3(aX3,aY3)-P4(aX4,aY4)
.
If the two lines are parallel, the middle point between the end point
of the first segment and the start point of the second segment is returned.aX1
- x-coordinate of an end point of the first line segment.aY1
- y-coordinate of an end point of the first line segment.aX2
- x-coordinate of an end point of the first line segment.aY2
- y-coordinate of an end point of the first line segment.aX3
- x-coordinate of an end point of the second line segment.aY3
- y-coordinate of an end point of the second line segment.aX4
- x-coordinate of an end point of the second line segment.aY4
- y-coordinate of an end point of the second line segment.a2DEditablePoint
- the intersection point of the two line segments as side effect.public static int intersection2DLines(ILcdPoint aP1, ILcdPoint aP2, ILcdPoint aP3, ILcdPoint aP4, ILcd2DEditablePoint aResultSFCT)
aP1
and aP2
, and the line going
through aP3
and aP4
.
aP1
- the first point on the first line.aP2
- the second point on the first line.aP3
- the first point on the second line.aP4
- the second point on the second line.aResultSFCT
- the intersection point of the two lines as side effect, if it exists. Can be null, if you're
not interested in this result.0
if the lines are parallel, but don't coincide.
1
if the lines intersect. The intersection point is stored in aResultSFCT
.
2
if the lines coincide.public static int intersection2DLines(double aX1, double aY1, double aX2, double aY2, double aX3, double aY3, double aX4, double aY4, ILcd2DEditablePoint aResultSFCT)
P1(aX1,aY1)
and P2(aX2,aY2)
, and
the line going through P3(aX3,aY3)
and P4(aX4,aY4)
.
aX1
- x-coordinate of the first point on the first line.aY1
- y-coordinate of the first point on the first line.aX2
- x-coordinate of the second point on the first line.aY2
- y-coordinate of the second point on the first line.aX3
- x-coordinate of the first point on the second line.aY3
- y-coordinate of the first point on the second line.aX4
- x-coordinate of the second point on the second line.aY4
- y-coordinate of the second point on the second line.aResultSFCT
- the intersection point of the two lines as side effect, if it exists. Can be null, if you're
not interested in this result.0
if the lines are parallel, but don't coincide.
1
if the lines intersect. The intersection point is stored in aResultSFCT
.
2
if the lines coincide.public static int intersection2DLineSegments(ILcdPoint aP1, ILcdPoint aP2, ILcdPoint aP3, ILcdPoint aP4, ILcd2DEditablePoint aResult1SFCT, ILcd2DEditablePoint aResult2SFCT)
P1(aX1,aY1)-P2(aX2,aY2)
and
P3(aX3,aY3)-P4(aX4,aY4)
, if it exists.aP1
- the first end point of the first line segment.aP2
- the second end point of the first line segment.aP3
- the first end point of the second line segment.aP4
- the second end point of the second line segment.aResult1SFCT
- the intersection point of the two line segments as side effect, if it exists, or one end point
of the overlap segment in case the line segments overlap. Can be null, if you're not interested
in this result.aResult2SFCT
- the other end point of the overlap segment in case the line segments overlap. Can be null, if
you're not interested in this result and aResult1SFCT
is null as well.0
if the line segments do not intersect or overlap.
1
if the line segments intersect. The intersection point is stored in aResult1SFCT
.
2
if the line segments overlap. The end points of the overlap segment are stored in
aResult1SFCT
and aResult2SFCT
.public static int intersection2DLineSegments(double aX1, double aY1, double aX2, double aY2, double aX3, double aY3, double aX4, double aY4, ILcd2DEditablePoint aResult1SFCT, ILcd2DEditablePoint aResult2SFCT)
P1(aX1,aY1)-P2(aX2,aY2)
and
P3(aX3,aY3)-P4(aX4,aY4)
, if it exists.aX1
- x-coordinate of the first end point of the first line segment.aY1
- y-coordinate of the first end point of the first line segment.aX2
- x-coordinate of the second end point of the first line segment.aY2
- y-coordinate of the second end point of the first line segment.aX3
- x-coordinate of the first end point of the second line segment.aY3
- y-coordinate of the first end point of the second line segment.aX4
- x-coordinate of the second end point of the second line segment.aY4
- y-coordinate of the second end point of the second line segment.aResult1SFCT
- the intersection point of the two line segments as side effect, if it exists, or one end point
of the overlap segment in case the line segments overlap. Can be null, if you're not interested
in this result.aResult2SFCT
- the other end point of the overlap segment in case the line segments overlap. Can be null, if
you're not interested in this result and aResult1SFCT
is null as well.0
if the line segments do not intersect or overlap.
1
if the line segments intersect. The intersection point is stored in aResult1SFCT
.
2
if the line segments overlap. The end points of the overlap segment are stored in
aResult1SFCT
and aResult2SFCT
.public static boolean contains2D(double aX1, double aY1, double aX2, double aY2, double aXP, double aYP)
aX1
- x-coordinate of an end point of the line segment.aY1
- y-coordinate of an end point of the line segment.aX2
- x-coordinate of an end point of the line segment.aY2
- y-coordinate of an end point of the line segment.aXP
- x-coordinate of the point to test.aYP
- y-coordinate of the point to test.public static boolean contains3D(double aX1, double aY1, double aZ1, double aX2, double aY2, double aZ2, double aXP, double aYP, double aZP)
aX1
- x-coordinate of an end point of the line segment.aY1
- y-coordinate of an end point of the line segment.aZ1
- z-coordinate of an end point of the line segment.aX2
- x-coordinate of an end point of the line segment.aY2
- y-coordinate of an end point of the line segment.aZ2
- z-coordinate of an end point of the line segment.aXP
- x-coordinate of the point to test.aYP
- y-coordinate of the point to test.aZP
- z-coordinate of the point to test.public static boolean contains2DLS(double aX1, double aY1, double aX2, double aY2, double aX3, double aY3, double aX4, double aY4)
(aX1,aY1)-(aX2,aY2)
contains
the line segment (aX3,aY3)-(aX4,aY4)
.aX1
- x-coordinate of an end point of the first line segment.aY1
- y-coordinate of an end point of the first line segment.aX2
- x-coordinate of an end point of the first line segment.aY2
- y-coordinate of an end point of the first line segment.aX3
- x-coordinate of an end point of the second line segment.aY3
- y-coordinate of an end point of the second line segment.aX4
- x-coordinate of an end point of the second line segment.aY4
- y-coordinate of an end point of the second line segment.public static boolean intersects2DSR(double aX1, double aY1, double aWidth1, double aHeight1, double aX2, double aY2, double aWidth2, double aHeight2)
aX1
- x-coordinate of lower left point of rectangle.aY1
- y-coordinate of lower left point of rectangle.aWidth1
- width of rectangle.aHeight1
- height of rectangle.aX2
- x-coordinate of lower left point of rectangle.aY2
- y-coordinate of lower left point of rectangle.aWidth2
- width of rectangle.aHeight2
- height of rectangle.true
if the two 2D rectangles intersect, false
otherwise.public static boolean overlaps2DSR(double aX1, double aY1, double aWidth1, double aHeight1, double aX2, double aY2, double aWidth2, double aHeight2)
aX1
- x-coordinate of lower left point of rectangle.aY1
- y-coordinate of lower left point of rectangle.aWidth1
- width of rectangle.aHeight1
- height of rectangle.aX2
- x-coordinate of lower left point of rectangle.aY2
- y-coordinate of lower left point of rectangle.aWidth2
- width of rectangle.aHeight2
- height of rectangle.true
if the two 2D rectangles overlap, false
otherwise.public static boolean overlaps2DSRLowLeft(double aX1, double aY1, double aWidth1, double aHeight1, double aX2, double aY2, double aWidth2, double aHeight2)
aX1
- x-coordinate of lower left point of rectangle.aY1
- y-coordinate of lower left point of rectangle.aWidth1
- width of rectangle.aHeight1
- height of rectangle.aX2
- x-coordinate of lower left point of rectangle.aY2
- y-coordinate of lower left point of rectangle.aWidth2
- width of rectangle.aHeight2
- height of rectangle.true
if they overlap, false
otherwise.public static boolean contains2DSR(double aX1, double aY1, double aWidth1, double aHeight1, double aX2, double aY2, double aWidth2, double aHeight2)
aX1
- x-coordinate of lower left point of rectangle.aY1
- y-coordinate of lower left point of rectangle.aWidth1
- width of rectangle.aHeight1
- height of rectangle.aX2
- x-coordinate of lower left point of rectangle.aY2
- y-coordinate of lower left point of rectangle.aWidth2
- width of rectangle.aHeight2
- height of rectangle.true
if the first 2D rectangle contains the second one, false
otherwise.public static boolean rectangleContains2D(double aX, double aY, double aStartPointX, double aStartPointY, double aEndPointX, double aEndPointY, double aWidth)
aX,aY
.
The rectangle is defined by the line segment
(aStartPoint,aEndPoint)
as axis and aWidth
as width. Half of the rectangle lies left of the axis, the other half
at the right side of the axis.aX
- x-coordinate of point to test.aY
- y-coordinate of point to test.aStartPointX
- x-coordinate of start axis-point.aStartPointY
- y-coordinate of start axis-point.aEndPointX
- x-coordinate of end axis-point.aEndPointY
- y-coordinate of end axis-point.aWidth
- width of the (rotated) rectangle.true
if the rectangle contains the 2D point, false
otherwise.public static boolean simpleRectangleContains2D(double aX, double aY, double aPointX, double aPointY, double aWidth, double aHeight)
(aPointX,aPointY)
, the width aWidth
, and the
height aHeight
contains the 2D point (aX,aY)
.aX
- x-coordinate of point to test.aY
- y-coordinate of point to test.aPointX
- x-coordinate of lower left point of rectangle.aPointY
- t-coordinate of lower left point of rectangle.aWidth
- width of the rectangle.aHeight
- height of the rectangle.true
if the 2D rectangle contains the 2D point, false
otherwise.public static void bufferContour2DOfSegmentSFCT(ILcdPoint aStartPoint, ILcdPoint aEndPoint, double aWidth, ILcd2DEditablePoint[] a2DEditablePointArraySFCT)
aStartPoint
, aEndPoint
, and aWidth
,
as an array of ILcd2DEditablePoint
objects.
The ordering of the points of the contour is clockwise starting from the
first point of the rectangle.
An alternative implementation based on ILcdGeoBuffer
objects is provided by
computeBufferContour2D
, which offers more flexibility
regarding the contour representation at the end points
(see ILcdGeoBuffer.getEndCapStyle
).
aStartPoint
- start axis point of the buffer segment.aEndPoint
- end axis point of the buffer segment.aWidth
- width of the buffer segment.a2DEditablePointArraySFCT
- an initialized array of 4 ILcd2DEditablePoint
which will contain the polygon.public static void contour2DOfBoundsSFCT(ILcdBounds aBounds, ILcd2DEditablePoint[] a2DEditablePointArraySFCT)
ILcdBounds
,
as an array of ILcd2DEditablePoint
objects.aBounds
- an ILcdBounds
2D rectangle.a2DEditablePointArraySFCT
- an initialized array of 4 ILcd2DEditablePoint
objects which will contain the contour.public static void bufferContour2DOf2DPolyline(ILcdPointList aPointList, double aWidth, double aRadius, ILcd2DEditablePoint[] a2DEditablePointArraySFCT)
bufferContour2DOf2DPolyline
without the aRadius
parameter instead.ILcd2DEditablePolyline
at a given width.aPointList
- axis of the buffer.aWidth
- the Euclidian distance corresponding to the width of
the buffer to be found along a2DPolyline
.aRadius
- Not used! The reason of the deprecation of this method.a2DEditablePointArraySFCT
- an initialized array of
a2DPolyline.countPoint * 2
ILcd2DEditablePoint
objects which will contain the contour.public static void bufferContour2DOf2DPolyline(ILcdPointList aPointList, double aWidth, ILcd2DEditablePoint[] a2DEditablePointArraySFCT)
ILcd2DEditablePolyline
at a given width.
The ordering of the points of the contour is clockwise starting from the first point of the rectangle.
This implementation has the following limitations:
ILcd2DEditablePoint
array,TLcdCartesian#computeBufferContour2D
.aPointList
- axis of the buffer.aWidth
- the Euclidian distance corresponding to the width of
the buffer to be found along a2DPolyline
.a2DEditablePointArraySFCT
- an initialized array of
a2DPolyline.countPoint * 2
ILcd2DEditablePoint
objects which will contain the contour.public static boolean containsAngle(double aStartAngle, double aArcAngle, double aTargetAngle)
aTargetAngle
lies within the
arc segment starting at aStartAngle
extending over
aArcAngle
.
All angles are in decimal degrees positive COUNTERCLOCKWISE.aStartAngle
- the start angle of the arc interval (decimal degrees).aArcAngle
- the arc extent of the arc interval (decimal degrees).aTargetAngle
- the angle to test (decimal degrees).true
if aTargetAngle
lies within the arc segment.public static double normalizeAngle(double aAngle)
aAngle
to the interval ]-180, 180].aAngle
- angle to normalize (degrees).public static boolean arcContains2D(double aCenterX, double aCenterY, double aMajorAxis, double aMinorAxis, double aRotAngle, double aStartAngle, double aArcAngle, double aX, double aY)
aCenterX
- x-coordinate of the center point of the elliptical arc.aCenterY
- y-coordinate of the center point of the elliptical arc.aMajorAxis
- the major axis of the ellipse.aMinorAxis
- the minor axis of the ellipse.aRotAngle
- the rotation of the major axis (decimal degrees).aStartAngle
- the start angle of the elliptical arc segment (decimal degrees).aArcAngle
- the elliptical arc extent (decimal degrees).aX
- x-coordinate of the point to be tested.aY
- y-coordinate of the point to be tested.public static boolean ellipseContains2D(double aCenterX, double aCenterY, double aMajorAxis, double aMinorAxis, double aRotAngle, double aX, double aY)
aCenterX
- x-coordinate of the center point of the elliptical arc.aCenterY
- y-coordinate of the center point of the elliptical arc.aMajorAxis
- the major axis of the ellipse.aMinorAxis
- the minor axis of the ellipse.aRotAngle
- the rotation of the major axis (decimal degrees).aX
- x-coordinate of the point to be tested.aY
- y-coordinate of the point to be tested.public static ILcdComplexPolygon computeBufferContour2D(ILcdGeoBuffer aBuffer)
ILcdGeoBuffer
in the cartesian space.
Only ILcdGeoBuffer
objects with a base shape of the type ILcdPolyline
,
ILcdPolygon
, ILcdComplexPolygon
or ILcdPoint
are supported.
By definition, the contour of the buffer is constructed by creating a closed polygon
around the axis, in which each point lies at a distance equal to the width from the axis
- except for the end points, which can have a custom style (see
ILcdGeoBuffer.getEndCapStyle()
).
The contour is modeled as a complex polygon (i.e., a composite polygon consisting of one or more polygons
that each define an edge of the contour). In the simplest form, the contour is represented
by a single polygon. In cases where the buffer intersects with itself,
holes are formed and multiple polygons are used to define the contour.
aBuffer
- the buffer for which the contour must be calculated.public static boolean computeInsidePoint(ILcdPointList aPointList, ILcd2DEditablePoint aInsidePointSFCT)
aPointList
- the polygon in which a point should be computedaInsidePointSFCT
- side effect parameter that receives the coordinates of the pointILcdShape.contains2D(com.luciad.shape.ILcdPoint)
public static boolean computeInsidePoint(ILcdPointList aPointList, List<? extends ILcdPointList> aExcludedPointLists, ILcd2DEditablePoint aInsidePointSFCT)
aPointList
- a polygon, defined as a point listaExcludedPointLists
- a list of polygons that should be excluded from the result. I.e. the
resulting point is guaranteed not to lie inside one of these polygons.aInsidePointSFCT
- the point in which the result will be stored.public static void cartesianPointSFCT(ILcdPoint aP1, ILcdPoint aP2, double aFraction, ILcd3DEditablePoint aPointSFCT)
aP1
- the first pointaP2
- the second pointaFraction
- the distance between the first point and the interpolated point relative to
the distance between the first and the second point.aPointSFCT
- the linearly interpolated point on return of the methodpublic static void cartesianPointSFCT(ILcdPoint aPoint, double aDistance, double aAzimuth, ILcd2DEditablePoint aPointSFCT)
(aP1.getX(), aP1.getY())
located at a
distance aDistance
and forward azimuth aAzimuth
.aPoint
- ILcdPoint
on the ellipsoid.aDistance
- distance expressed in meters.aAzimuth
- forward azimuth expressed in degrees (zero maps to the north).aPointSFCT
- side effect parameter that contains the result upon return of the method.public static boolean areCollinear2D(ILcdPoint aP1, ILcdPoint aP2, ILcdPoint aP3)
aP1
- the first point.aP2
- the second point.aP3
- the third point.public static boolean areCollinear2D(double aX1, double aY1, double aX2, double aY2, double aX3, double aY3)
aX1
- x-coordinate of the first point.aY1
- y-coordinate of the first point.aX2
- x-coordinate of the second point.aY2
- y-coordinate of the second point.aX3
- x-coordinate of the third point.aY3
- y-coordinate of the third point.