public class TLcdSphereUtil extends Object
TLcdSphereUtil
is a utility class that implements spherical
trigonometry. All implementations are based on a sphere with a unity radius.
All results are in arc degrees.Constructor and Description |
---|
TLcdSphereUtil() |
Modifier and Type | Method and Description |
---|---|
static boolean |
arcContains2D(ILcdArc aArc,
double aSphereRadius,
ILcdPoint aLLPoint)
Checks whether the point
aLLPoint lies on the elliptical arc segment. |
static boolean |
arcContains2D(ILcdPoint aCenter,
double aMajorAxe,
double aMinorAxe,
double aRotAngle,
double aStartAngle,
double aArcAngle,
double aSphereRadius,
ILcdPoint aLLPoint)
Checks whether the point
aLLPoint lies on the elliptical arc segment. |
static double |
arcDegreesToMeters(double aArcDegreeDistance,
double aSphereRadius)
Converts the given distance of the given arc into a distance in meters, using the given sphere radius.
|
static void |
bufferContour2DOf2DPolyline(ILcdPointList aPointList,
double aWidth,
ILcd2DEditablePoint[] a2DEditablePointArraySFCT)
Calculates the contour of the buffer/corridor along a given
ILcdPointList
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 4 ILcd2DEditablePoint
objects. |
static void |
calculateBounds(ILcdPointList aPointList,
boolean aPolygon,
ILcd2DEditableBounds aBoundsSFCT)
Calculates the bounding box containing the polyline/polygon formed by
the point list assuming great circle line segments.
|
static boolean |
circleContains2D(ILcdPoint aCenter,
double aCircleRadius,
double aSphereRadius,
ILcdPoint aPoint)
Checks whether the point
aPoint lies within the circle
(aCenter,aCircleRadius) on the sphere with radius
aSphereRadius . |
static double |
closestDistanceToGeodesic(ILcdPoint aP1,
ILcdPoint aP2,
ILcdPoint aP3,
boolean aClipToLineSegment)
Calculates the shortest distance between the geodetic line (segment)
aP1-aP2
and point aP3 . |
static double |
closestPointOnGeodesic(ILcdPoint aP1,
ILcdPoint aP2,
ILcdPoint aP3,
boolean aClipToLineSegment,
ILcd2DEditablePoint aPSFCT)
Calculates the shortest distance between the geodesic through
aP1-aP2
and the point aP3 , and also the point on the geodesic aP1-aP2
that is the closest to point aP3. |
static double |
closestPointOnGeodesic(ILcdPoint aP1,
ILcdPoint aP2,
ILcdPoint aP3,
ILcd2DEditablePoint aPSFCT)
Calculates the shortest distance between the geodesic line segment
aP1-aP2
and point aP3 , and also the point on the geodesic aP1-aP2
that is the closest to point aP3. |
static double |
closestPointOnShape(ILcdPoint aPoint,
ILcdShape aShape,
ILcd2DEditablePoint aResultSFCT)
Finds the shortest distance from the given point to the given shape.
|
static boolean |
contains2D(ILcdPoint aP1,
ILcdPoint aP2,
ILcdPoint aPoint)
Checks whether the point
aPoint lies on the geodesic line segment
aP1-aP2 . |
static boolean |
contains2DLS(ILcdPoint aP1,
ILcdPoint aP2,
ILcdPoint aP3,
ILcdPoint aP4)
Checks if the line segment
aP1-aP2 contains the line segment
aP3-aP4 . |
static boolean |
contains2DSR(double aLon1,
double aLat1,
double aWidth1,
double aHeight1,
double aLon2,
double aLat2,
double aWidth2,
double aHeight2)
Checks whether a 2D rectangle contains another rectangle.
|
static void |
contour2DOfBoundsSFCT(ILcdBounds aBounds,
ILcd2DEditablePoint[] a2DEditablePointArraySFCT)
Calculates the contour of the given
ILcdBounds , as an array of
ILcd2DEditablePoint objects. |
static double |
distanceToGeodesic(double aLon1,
double aLat1,
double aLon2,
double aLat2,
double aLon3,
double aLat3,
double aAngle)
Calculates the distance between the geodesic line through
(aLon1,aLat1)-(aLon2,aLat2) and point (aLon3,aLat3) ,
at a certain angle aAngle . |
static double |
distanceToGeodesic(ILcdPoint aP1,
ILcdPoint aP2,
ILcdPoint aP3,
double aAngle)
Calculates the distance between the geodesic line determined by
aP1-aP2
and the point aP3 , at a certain angle aAngle . |
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 void |
geoc2llhSFCT(ILcdPoint aXYZPoint,
double aRadius,
ILcd3DEditablePoint aLLHOut)
Coordinate conversion from earth centered, earth fixed cartesian
coordinates (X,Y,Z) to geodetic coordinate
(l, j ,h ) ,
with h the height above the sphere. |
static double |
geodesicArea(ILcdPoint[] aPts,
int aN)
Geodesic surface area of a polygon on the sphere.
|
static double |
geodesicArea(ILcdPoint[] aPts,
int aN,
double aRadius)
Geodesic surface area of a polygon on the sphere.
|
static double |
geodesicArea(ILcdShape aShape,
double aRadius)
Calculates the geodesic area of a shape.
|
static double |
greatCircleDistance(double aLon1,
double aLat1,
double aLon2,
double aLat2)
Great circle distance from
aP1 to aP2 in arc degrees ! |
static double |
greatCircleDistance(double aLon1,
double aLat1,
double aCosLat1,
double aLon2,
double aLat2,
double aCosLat2)
Great circle distance from
aP1 to aP2 in arc degrees ! |
static double |
greatCircleDistance(ILcdPoint aP1,
ILcdPoint aP2)
Calculates the shortest distance between
aP1 and aP2 . |
static double |
greatCircleDistance3D(ILcdPoint aPoint1,
ILcdPoint aPoint2,
double aRadius)
Calculates the distance to go from point p1 to point p2.
|
static double |
greatCircleDistanceEast2West(double aLon1,
double aLat1,
double aLon2,
double aLat2)
Calculates the distance between
aP1 and aP2 ,
tracing the sphere from east to west. |
static double |
greatCircleDistanceEast2West(ILcdPoint aP1,
ILcdPoint aP2)
Calculates the distance between
aP1 and aP2 ,
tracing the sphere from east to west. |
static double |
greatCircleDistanceWest2East(double aLon1,
double aLat1,
double aLon2,
double aLat2)
Calculates the distance between
aP1 and aP2 ,
tracing the sphere from west to east. |
static double |
greatCircleDistanceWest2East(ILcdPoint aP1,
ILcdPoint aP2)
Calculates the distance between
aP1 and aP2 ,
tracing the sphere from west to east. |
static void |
greatCirclePointSFCT(ILcdPoint aP1,
double aDistance,
double aAzimuth,
ILcd2DEditablePoint aGreatCirclePoint)
Calculates
aGreatCirclePoint to be a point on the great circle
through aP1 , located at a distance aD and forward
azimuth aAzimuth . |
static void |
greatCirclePointSFCT(ILcdPoint aP1,
ILcdPoint aP2,
double aK,
ILcd2DEditablePoint aGreatCirclePoint)
Calculates
aGreatCirclePoint to be a point on the great circle
through aP1 and aP2 , located at a fraction aK
of the shortest distance between the two point aP1 and aP2 . |
static int |
intersection2DLineSegments(ILcdPoint aP1,
ILcdPoint aP2,
ILcdPoint aP3,
ILcdPoint aP4,
ILcd2DEditablePoint aLLResultSFCT1,
ILcd2DEditablePoint aLLResultSFCT2)
Intersection of two geodesic line segments on a sphere.
|
static void |
intersection2DLSSFCT(double aLon1,
double aLat1,
double aLon2,
double aLat2,
double aLon3,
double aLat3,
double aLon4,
double aLat4,
ILcd2DEditablePoint aLLP)
Deprecated.
the name of this method contradicts the actual behavior, use
intersectionGeodesicGeodesic(com.luciad.shape.ILcdPoint, com.luciad.shape.ILcdPoint, com.luciad.shape.ILcdPoint, com.luciad.shape.ILcdPoint, com.luciad.shape.shape2D.ILcd2DEditablePoint) |
static void |
intersection2DLSSFCT(ILcdPoint aP1,
ILcdPoint aP2,
ILcdPoint aP3,
ILcdPoint aP4,
ILcd2DEditablePoint aLLResultSFCT)
Deprecated.
the name of this method contradicts the actual behavior, use
intersectionGeodesicGeodesic(com.luciad.shape.ILcdPoint, com.luciad.shape.ILcdPoint, com.luciad.shape.ILcdPoint, com.luciad.shape.ILcdPoint, com.luciad.shape.shape2D.ILcd2DEditablePoint) |
static int |
intersection2DLSSFCT(ILcdPoint aP1,
ILcdPoint aP2,
ILcdPoint aP3,
ILcdPoint aP4,
ILcd2DEditablePoint aLLResultSFCT1,
ILcd2DEditablePoint aLLResultSFCT2)
Deprecated.
the name of this method contradicts the actual behavior, use
intersectionGeodesicGeodesic(com.luciad.shape.ILcdPoint, com.luciad.shape.ILcdPoint, com.luciad.shape.ILcdPoint, com.luciad.shape.ILcdPoint, com.luciad.shape.shape2D.ILcd2DEditablePoint) |
static void |
intersectionGeodesicGeodesic(ILcdPoint aP1,
ILcdPoint aP2,
ILcdPoint aP3,
ILcdPoint aP4,
ILcd2DEditablePoint aLLResultSFCT)
Calculates the intersection point of two great circle lines (geodesics) defined by the given points.
|
static boolean |
intersects2DCircleLineSegment(ILcdPoint aCenter,
double aRadius,
ILcdPoint aP1,
ILcdPoint aP2)
Checks whether a circle and a line segment intersect each other.
|
static boolean |
intersects2DCircularArcCircularArc(ILcdPoint aCenter1,
double aRadius1,
double aStartAngle1,
double aArcAngle1,
ILcdPoint aCenter2,
double aRadius2,
double aStartAngle2,
double aArcAngle2)
Checks whether two circular arcs intersect each other.
|
static boolean |
intersects2DLineSegmentCircularArc(ILcdPoint aP1,
ILcdPoint aP2,
ILcdPoint aCenter,
double aRadius,
double aStartAngle,
double aArcAngle)
Checks whether a line segment and a circular arc segment intersect each
other.
|
static boolean |
intersects2DLineSegments(double aLon1,
double aLat1,
double aLon2,
double aLat2,
double aLon3,
double aLat3,
double aLon4,
double aLat4)
Checks whether two geodesic line segments defined by the pairs
(aLon1,aLat1)-(aLon2,aLat2) and
(aLon3,aLat3)-(aLon4,aLat4) intersect each other. |
static boolean |
intersects2DLineSegments(ILcdPoint aP1,
ILcdPoint aP2,
ILcdPoint aP3,
ILcdPoint aP4)
Checks whether two geodesic line segments defined by the pairs
aP1-aP2
and aP3-aP4 intersect each other. |
static boolean |
intersects2DLS(double aLon1,
double aLat1,
double aLon2,
double aLat2,
double aLon3,
double aLat3,
double aLon4,
double aLat4)
Checks whether two geodesic line segments defined by the pairs
(aLon1,aLat1)-(aLon2,aLat2) and
(aLon3,aLat3)-(aLon4,aLat4) intersect each other. |
static boolean |
intersects2DLS(ILcdPoint aP1,
ILcdPoint aP2,
ILcdPoint aP3,
ILcdPoint aP4)
Checks whether two geodesic line segments defined by the pairs
aP1-aP2
and aP3-aP4 intersect each other. |
static boolean |
intersects2DSR(double aLon1,
double aLat1,
double aWidth1,
double aHeight1,
double aLon2,
double aLat2,
double aWidth2,
double aHeight2)
Checks whether two 2D rectangles intersect.
|
static void |
llh2geocSFCT(ILcdPoint aLLHPoint,
double aRadius,
ILcd3DEditablePoint aXYZOut)
Coordinate conversion from geodetic coordinate
(l,
j ,h ) to earth centered, earth
fixed Cartesian coordinates (X,Y,Z) . |
static double |
metersToArcDegrees(double aDistance,
double aSphereRadius)
Converts the given distance in meters into a distance in arc degrees, using the given sphere radius.
|
static int |
orientation2D(ILcdPoint[] aPoints,
int aNumberOfPoints)
Calculates the orientation of an array of points on a sphere.
|
static int |
orientation2D(ILcdPointList aPointList)
Calculates the orientation of a point list on a sphere.
|
static boolean |
overlaps2DSR(double aLon1,
double aLat1,
double aWidth1,
double aHeight1,
double aLon2,
double aLat2,
double aWidth2,
double aHeight2)
Checks whether two 2D rectangles overlap.
|
static boolean |
overlaps2DSRLowLeft(double aLon1,
double aLat1,
double aWidth1,
double aHeight1,
double aLon2,
double aLat2,
double aWidth2,
double aHeight2)
Checks whether two 2D rectangles overlap.
|
static boolean |
polygonContains2D(ILcdPolygon aPolygon,
double aLonP,
double aLatP)
Checks if a point lies inside a polygon.
|
static boolean |
polygonContains2D(ILcdPolygon aPolygon,
ILcdPoint aPoint)
Checks if a point lies inside a polygon.
|
public static double metersToArcDegrees(double aDistance, double aSphereRadius)
aDistance
- the distance in metersaSphereRadius
- the radius of the underlying spherepublic static double arcDegreesToMeters(double aArcDegreeDistance, double aSphereRadius)
aArcDegreeDistance
- a distance on the sphere in degreesaSphereRadius
- the radius of the underlying spherepublic static double greatCircleDistance(ILcdPoint aP1, ILcdPoint aP2)
aP1
and aP2
.
As a result, the difference will never exceed 180 degrees !aP1
- first point.aP2
- second point.public static double greatCircleDistance(double aLon1, double aLat1, double aLon2, double aLat2)
aP1
to aP2
in arc degrees !aLon1
- longitude of the first point in degrees.aLat1
- latitude of the first point in degrees.aLon2
- longitude of the second point in degrees.aLat2
- latitude of the second point in degrees.public static double greatCircleDistance(double aLon1, double aLat1, double aCosLat1, double aLon2, double aLat2, double aCosLat2)
aP1
to aP2
in arc degrees !aLon1
- longitude of start point of line segment in degrees.aLat1
- latitude of start point of line segment in degrees.aCosLat1
- cosine of the latitude of the start point.aLon2
- longitude of end point of line segment in degrees.aLat2
- latitude of end point of line segment in degrees.aCosLat2
- cosine of the latitude of the end point.public static double distanceToGeodesic(ILcdPoint aP1, ILcdPoint aP2, ILcdPoint aP3, double aAngle)
aP1-aP2
and the point aP3
, at a certain angle aAngle
.
Returns result in degrees.aP1
- defining point of geodesic line.aP2
- defining point of geodesic line.aP3
- point from which the distance needs to be calculated.aAngle
- defines the angle between the geodesic lines defined by the
point aP3
and the point of crossing and the geodesic line
defined by aP1
and aP2
and the point of
crossing. Should be specified in degrees.public static double distanceToGeodesic(double aLon1, double aLat1, double aLon2, double aLat2, double aLon3, double aLat3, double aAngle)
(aLon1,aLat1)-(aLon2,aLat2)
and point (aLon3,aLat3)
,
at a certain angle aAngle
.
Returns result in degrees.aAngle
- defines the angle between the geodesic defined by
(aLon3,aLat3)
and the point of crossing and the geodesic
defined by (aLon2,aLat2)
and the point of crossing.aLon1
- longitude of defining point of geodesic line in degrees.aLat1
- latitude of defining point of geodesic line in degrees.aLon2
- longitude of defining point of geodesic line in degrees.aLat2
- latitude of defining point of geodesic line in degrees.aLon3
- longitude of third point in degrees.aLat3
- latitude of third point in degrees.public static double closestDistanceToGeodesic(ILcdPoint aP1, ILcdPoint aP2, ILcdPoint aP3, boolean aClipToLineSegment)
aP1-aP2
and point aP3
.aP1
- start point of the geodesic.aP2
- end point of the geodesic.aP3
- point from which the distance has to be calculated.aClipToLineSegment
- if false
, the shortest distance will be calculated for
the whole geodesic. Otherwise it will only be calculated for the
geodesic line segment aP1-aP2
.public static double closestPointOnShape(ILcdPoint aPoint, ILcdShape aShape, ILcd2DEditablePoint aResultSFCT)
This methods supports
geodetic
and rhumb
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 closestPointOnGeodesic(ILcdPoint aP1, ILcdPoint aP2, ILcdPoint aP3, ILcd2DEditablePoint aPSFCT)
aP1-aP2
and point aP3
, and also the point on the geodesic aP1-aP2
that is the closest to point aP3.aP1
- start point of geodesic.aP2
- end point of geodesic.aP3
- point from which the distance has to be calculated.aPSFCT
- point that will contain the coordinate of the point on the
geodesic line segment aP1-aP2
that is calculated to be at
the shortest distance to aP3
.public static double closestPointOnGeodesic(ILcdPoint aP1, ILcdPoint aP2, ILcdPoint aP3, boolean aClipToLineSegment, ILcd2DEditablePoint aPSFCT)
aP1-aP2
and the point aP3
, and also the point on the geodesic aP1-aP2
that is the closest to point aP3. The flag aClipToLineSegment
determines
whether the geodesic is to be considered as the geodesic line segment defined by the two
points or as the geodesic line through the two points.aP1
- start point of geodesic.aP2
- end point of geodesic.aP3
- point from which the distance has to be calculated.aPSFCT
- point that will contain the coordinate of the
point on the geodesic through aP1-aP2
that is calculated
to be at the shortest distance to aP3
. This point may be
clipped onto the line segment depending on the value of aClipToLineSegment
.aClipToLineSegment
- Description of Parameterpublic static double geodesicArea(ILcdPoint[] aPts, int aN)
Constraints: (aN > 2
) and (aPts.length >= aN
).
aPts
- array of ILcdPoint
objects.aN
- aPts[0..aN-1]
defines the polygon on the sphere.public static double geodesicArea(ILcdPoint[] aPts, int aN, double aRadius)
Constraints: (aN > 2
) and (aPts.length >= aN
).
aPts
- array of ILcdPoint
objects.aN
- aPts[0..aN-1]
defines the polygon on the sphere.aRadius
- radius of the sphere.public static double geodesicArea(ILcdShape aShape, double aRadius)
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 aboveaRadius
- radius of the sphere, in meterTLcdEllipsoidUtil.geodesicArea(ILcdShape, ILcdEllipsoid)
,
TLcdCartesian.area(ILcdShape)
public static int orientation2D(ILcdPoint[] aPoints, int aNumberOfPoints)
Constraints: (aNumberOfPoints
> 2) and (aPoints.length >= aNumberOfPoints
).
aPoints
- array of ILcdPoint
objects (first point is not repeated).aNumberOfPoints
- the number of points of the array to take into account.public static int orientation2D(ILcdPointList aPointList)
Constraints: (aPointList.length > 2
).
aPointList
- the point list to compute the orientation of. Note that this implies
interpreting the point list as a polygon. The last point of the point
list does not need to be equal to the first point.ILcdPolygon.CLOCKWISE
and ILcdPolygon.COUNTERCLOCKWISE
.public static double forwardAzimuth2D(ILcdPoint aP1, ILcdPoint aP2)
aP1
to aP2
in RADIANS! The
resulting value lies between [0.0, 2.0*Math.PI]. See Maling p. 62.aP1
- start point.aP2
- end point.public static void greatCirclePointSFCT(ILcdPoint aP1, double aDistance, double aAzimuth, ILcd2DEditablePoint aGreatCirclePoint)
aGreatCirclePoint
to be a point on the great circle
through aP1
, located at a distance aD
and forward
azimuth aAzimuth
.aP1
- start ILcdPoint
on the sphere.aDistance
- distance expressed in arc degrees.aAzimuth
- azimuth expressed in degrees.aGreatCirclePoint
- ILcd2DEditablePoint
on the sphere as side effect.public static void greatCirclePointSFCT(ILcdPoint aP1, ILcdPoint aP2, double aK, ILcd2DEditablePoint aGreatCirclePoint)
aGreatCirclePoint
to be a point on the great circle
through aP1
and aP2
, located at a fraction aK
of the shortest distance between the two point aP1
and aP2
.aP1
- start point of line segment.aP2
- end point of line segment.aK
- fraction of distance between aP1-aP2
to take.aGreatCirclePoint
- point at fraction aK
as side effect.public static void geoc2llhSFCT(ILcdPoint aXYZPoint, double aRadius, ILcd3DEditablePoint aLLHOut)
(l, j ,h )
,
with h the height above the sphere.aXYZPoint
- earth centered earth fixed cartesian coordinates (meters).aRadius
- radius of the sphere (meters).aLLHOut
- geodetic coordinate w.r.t. sphere, height expressed in meters.public static void llh2geocSFCT(ILcdPoint aLLHPoint, double aRadius, ILcd3DEditablePoint aXYZOut)
(l,
j ,h )
to earth centered, earth
fixed Cartesian coordinates (X,Y,Z) .aLLHPoint
- Geodetic coordinate (l,
j ,h )
.aRadius
- radius of the sphere.aXYZOut
- earth centered earth fixed cartesian coordinate.public static double greatCircleDistanceWest2East(ILcdPoint aP1, ILcdPoint aP2)
aP1
and aP2
,
tracing the sphere from west to east.aP1
- start point of line segment.aP2
- end point of line segment.public static double greatCircleDistanceWest2East(double aLon1, double aLat1, double aLon2, double aLat2)
aP1
and aP2
,
tracing the sphere from west to east.aLon1
- longitude of the start point of the line segment (in degrees).aLat1
- latitude of the start point of the line segment (in degrees).aLon2
- longitude of the end point of the line segment (in degrees).aLat2
- latitude of the end point of the line segment (in degrees).public static double greatCircleDistanceEast2West(ILcdPoint aP1, ILcdPoint aP2)
aP1
and aP2
,
tracing the sphere from east to west.aP1
- start point of line segment.aP2
- end point of line segment.public static double greatCircleDistanceEast2West(double aLon1, double aLat1, double aLon2, double aLat2)
aP1
and aP2
,
tracing the sphere from east to west.aLon1
- longitude of the start point of the line segment (in degrees).aLat1
- latitude of the start point of the line segment (in degrees).aLon2
- longitude of the end point of the line segment (in degrees).aLat2
- latitude of the end point of the line segment (in degrees).public static int intersection2DLineSegments(ILcdPoint aP1, ILcdPoint aP2, ILcdPoint aP3, ILcdPoint aP4, ILcd2DEditablePoint aLLResultSFCT1, ILcd2DEditablePoint aLLResultSFCT2)
aLLResultSFCT1
- side effect parameter that will contain the
intersection point if there is any.aLLResultSFCT2
- side effect parameter that will contain the
intersection point if there is any.aP1
- start point of first line segment.aP2
- start point of first line segment.aP3
- end point of second line segment.aP4
- end point of second line segment.public static boolean intersects2DLS(ILcdPoint aP1, ILcdPoint aP2, ILcdPoint aP3, ILcdPoint aP4)
aP1-aP2
and aP3-aP4
intersect each other.aP1
- start point of first line segment.aP2
- end point of first line segment.aP3
- start point of second line segment.aP4
- end point of second line segment.intersectionGeodesicGeodesic(com.luciad.shape.ILcdPoint, com.luciad.shape.ILcdPoint, com.luciad.shape.ILcdPoint, com.luciad.shape.ILcdPoint, com.luciad.shape.shape2D.ILcd2DEditablePoint)
public static boolean intersects2DLS(double aLon1, double aLat1, double aLon2, double aLat2, double aLon3, double aLat3, double aLon4, double aLat4)
(aLon1,aLat1)-(aLon2,aLat2)
and
(aLon3,aLat3)-(aLon4,aLat4)
intersect each other.aLon1
- longitude of start point of first line segment (in degrees).aLat1
- latitude of end point of first line segment (in degrees).aLon2
- longitude of start point of first line segment (in degrees).aLat2
- latitude of end point of first line segment (in degrees).aLon3
- longitude of start point of second line segment (in degrees).aLat3
- latitude of end point of second line segment (in degrees).aLon4
- longitude of start point of second line segment (in degrees).aLat4
- latitude of end point of second line segment (in degrees).public static boolean intersects2DLineSegments(ILcdPoint aP1, ILcdPoint aP2, ILcdPoint aP3, ILcdPoint aP4)
aP1-aP2
and aP3-aP4
intersect each other.aP1
- start point of first line segment.aP2
- start point of first line segment.aP3
- end point of second line segment.aP4
- end point of second line segment.intersectionGeodesicGeodesic(com.luciad.shape.ILcdPoint, com.luciad.shape.ILcdPoint, com.luciad.shape.ILcdPoint, com.luciad.shape.ILcdPoint, com.luciad.shape.shape2D.ILcd2DEditablePoint)
public static boolean intersects2DLineSegments(double aLon1, double aLat1, double aLon2, double aLat2, double aLon3, double aLat3, double aLon4, double aLat4)
(aLon1,aLat1)-(aLon2,aLat2)
and
(aLon3,aLat3)-(aLon4,aLat4)
intersect each other.aLon1
- longitude of start point of first line segment (in degrees).aLat1
- latitude of end point of first line segment (in degrees).aLon2
- longitude of start point of first line segment (in degrees).aLat2
- latitude of end point of first line segment (in degrees).aLon3
- longitude of start point of second line segment (in degrees).aLat3
- latitude of end point of second line segment (in degrees).aLon4
- longitude of start point of second line segment (in degrees).aLat4
- latitude of end point of second line segment (in degrees).intersects2DLineSegments(com.luciad.shape.ILcdPoint, com.luciad.shape.ILcdPoint, com.luciad.shape.ILcdPoint, com.luciad.shape.ILcdPoint)
,
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)
@Deprecated public static void intersection2DLSSFCT(ILcdPoint aP1, ILcdPoint aP2, ILcdPoint aP3, ILcdPoint aP4, ILcd2DEditablePoint aLLResultSFCT) throws IllegalArgumentException
intersectionGeodesicGeodesic(com.luciad.shape.ILcdPoint, com.luciad.shape.ILcdPoint, com.luciad.shape.ILcdPoint, com.luciad.shape.ILcdPoint, com.luciad.shape.shape2D.ILcd2DEditablePoint)
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 calculating the intersection of line segments.
Since great circle planes that do no coincide always have two intersection points, the most appropriate is chosen. If one of the two possibilities is on one of the line segments that one is chosen. Otherwise, the one closest to one of the end points is chosen.
aP1
- a point on the first geodesic.aP2
- another point on the first geodesic. Should not coincide with aP1.aP3
- a point on the second geodesic.aP4
- another point on the second geodesic. Should not coincide with aP3.aLLResultSFCT
- the intersection point as side effect.IllegalArgumentException
- if no intersection point can be found or chosen.public static void intersectionGeodesicGeodesic(ILcdPoint aP1, ILcdPoint aP2, ILcdPoint aP3, ILcdPoint aP4, ILcd2DEditablePoint aLLResultSFCT) throws IllegalArgumentException
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 calculating the intersection of line segments.
Since great circle planes that do no coincide always have two intersection points, the most appropriate is chosen. If one of the two possibilities is on one of the line segments that one is chosen. Otherwise, the one closest to one of the end points is chosen.
aP1
- a point on the first geodesic.aP2
- another point on the first geodesic. Should not coincide with aP1.aP3
- a point on the second geodesic.aP4
- another point on the second geodesic. Should not coincide with aP3.aLLResultSFCT
- the intersection point as side effect.IllegalArgumentException
- if no intersection point can be found or chosen.@Deprecated public static void intersection2DLSSFCT(double aLon1, double aLat1, double aLon2, double aLat2, double aLon3, double aLat3, double aLon4, double aLat4, ILcd2DEditablePoint aLLP) throws IllegalArgumentException
intersectionGeodesicGeodesic(com.luciad.shape.ILcdPoint, com.luciad.shape.ILcdPoint, com.luciad.shape.ILcdPoint, com.luciad.shape.ILcdPoint, com.luciad.shape.shape2D.ILcd2DEditablePoint)
(aLon1,aLat1)-(aLon2,aLat2)
and
(aLon3,aLat3)-(aLon4,aLat4)
.
The intersection does not necessarily lie on one of the two line segments.
Since great circle planes that do no coincide always have two intersection points,
the most appropriate is chosen. If one of the two possibilities is on one of the
line segments that one is chosen. Otherwise, the one closest to one of the end points
is chosen.aLon1
- longitude of start point of first line segment (in degrees).aLat1
- latitude of end point of first line segment (in degrees).aLon2
- longitude of start point of first line segment (in degrees).aLat2
- latitude of end point of first line segment (in degrees).aLon3
- longitude of start point of second line segment (in degrees).aLat3
- latitude of end point of second line segment (in degrees).aLon4
- longitude of start point of second line segment (in degrees).aLat4
- latitude of end point of second line segment (in degrees).aLLP
- the intersection point as side effect.IllegalArgumentException
- if no intersection point can be found or chosen.@Deprecated public static int intersection2DLSSFCT(ILcdPoint aP1, ILcdPoint aP2, ILcdPoint aP3, ILcdPoint aP4, ILcd2DEditablePoint aLLResultSFCT1, ILcd2DEditablePoint aLLResultSFCT2)
intersectionGeodesicGeodesic(com.luciad.shape.ILcdPoint, com.luciad.shape.ILcdPoint, com.luciad.shape.ILcdPoint, com.luciad.shape.ILcdPoint, com.luciad.shape.shape2D.ILcd2DEditablePoint)
aP1-aP2
and aP3-aP4
that intersect each
other. The points aP1
and aP2
should not coincide
nor should the points aP3
and aP4
.
The intersection does not necessarily lie on one of the two line segments.
However, great circle planes that do no coincide always have two intersection points.aP1
- start point of the first line segment.aP2
- end point of the first line segment.aP3
- start point of the second line segment.aP4
- end point of the second line segment.aLLResultSFCT1
- the intersection point as side effect.aLLResultSFCT2
- the intersection point as side effect.public static boolean intersects2DSR(double aLon1, double aLat1, double aWidth1, double aHeight1, double aLon2, double aLat2, double aWidth2, double aHeight2)
aLon1
- longitude of lower left corner point of the first rectangle in degrees.aLat1
- latitude of lower left corner point of the first rectangle in degrees.aWidth1
- width of the first rectangle (>=0) in degrees.aHeight1
- height of the first rectangle (>=0) in degrees.aLon2
- longitude of lower left corner point of the second rectangle in degrees.aLat2
- latitude of lower left corner point of the second rectangle in degrees.aWidth2
- width of the second rectangle (>=0) in degrees.aHeight2
- height of the second rectangle (>=0) in degrees.public static boolean overlaps2DSR(double aLon1, double aLat1, double aWidth1, double aHeight1, double aLon2, double aLat2, double aWidth2, double aHeight2)
aLon1
- longitude of lower left corner point in degrees.aLat1
- latitude of lower left corner point in degrees.aWidth1
- width of the rectangle (>=0) in degrees.aHeight1
- height of the rectangle (>=0) in degrees.aLon2
- longitude of lower left corner point in degrees.aLat2
- latitude of lower left corner point in degrees.aWidth2
- width of the rectangle (>=0) in degrees.aHeight2
- height of the rectangle (>=0) in degrees.public static boolean overlaps2DSRLowLeft(double aLon1, double aLat1, double aWidth1, double aHeight1, double aLon2, double aLat2, double aWidth2, double aHeight2)
aLon1
- longitude of lower left corner point in degrees.aLat1
- latitude of lower left corner point in degrees.aWidth1
- width of the rectangle (>=0) in degrees.aHeight1
- height of the rectangle (>=0) in degrees.aLon2
- longitude of lower left corner point in degrees.aLat2
- latitude of lower left corner point in degrees.aWidth2
- width of the rectangle (>=0) in degrees.aHeight2
- height of the rectangle (>=0) in degrees.public static boolean contains2D(ILcdPoint aP1, ILcdPoint aP2, ILcdPoint aPoint)
aPoint
lies on the geodesic line segment
aP1-aP2
.aP1
- start point of line segment.aP2
- end point of line segment.aPoint
- point to be checked.public static boolean circleContains2D(ILcdPoint aCenter, double aCircleRadius, double aSphereRadius, ILcdPoint aPoint)
aPoint
lies within the circle
(aCenter,aCircleRadius)
on the sphere with radius
aSphereRadius
.aCenter
- center point of the circle.aCircleRadius
- radius of the circle in meters.aSphereRadius
- radius of the sphere in meters.aPoint
- point to be tested.public static boolean arcContains2D(ILcdPoint aCenter, double aMajorAxe, double aMinorAxe, double aRotAngle, double aStartAngle, double aArcAngle, double aSphereRadius, ILcdPoint aLLPoint)
aLLPoint
lies on the elliptical arc segment.aCenter
- center point of the elliptical arc.aMajorAxe
- major axis of the elliptical arc (meters).aMinorAxe
- minor axis of the elliptical arc (meters).aRotAngle
- rotation angle of the axis in degrees.aStartAngle
- start angle of the arc segment in degrees, positive
counter clockwise, starting from 3O'clock.aArcAngle
- length of arc segment in arc degrees.aSphereRadius
- radius of the sphere in meters.aLLPoint
- point to be tested.public static boolean arcContains2D(ILcdArc aArc, double aSphereRadius, ILcdPoint aLLPoint)
aLLPoint
lies on the elliptical arc segment.aArc
- elliptical arc.aSphereRadius
- radius of the sphere in meters.aLLPoint
- point to be tested.public static boolean polygonContains2D(ILcdPolygon aPolygon, ILcdPoint aPoint)
ILcdPoint
aPoint
to be inside if:
aPoint
interacts with the polygon bounds
aPoint
has an odd number of polygon edge intersections
within a distance of 180 degrees in northern direction (azimuth zero
degrees) if this fails we also try in southern direction
aPolygon
- polygon w.r.t. which the test is performed.aPoint
- the point to be tested.public static boolean polygonContains2D(ILcdPolygon aPolygon, double aLonP, double aLatP)
aLonP
,aLatP
to be inside if:
aPolygon
- polygon w.r.t. which the test is performed.aLonP
- longitude of the point to be tested in degrees.aLatP
- latitude of the point to be tested in degrees.public static void calculateBounds(ILcdPointList aPointList, boolean aPolygon, ILcd2DEditableBounds aBoundsSFCT) throws TLcdNoBoundsException
aPointList
- polygon or polyline.aPolygon
- if true the point list is treated as a polygon,
otherwise as a polyline.aBoundsSFCT
- the bounding box for the polyline/polygon as side effect.TLcdNoBoundsException
- if the polyline/polygon doesn't have a bounding box.public static boolean contains2DLS(ILcdPoint aP1, ILcdPoint aP2, ILcdPoint aP3, ILcdPoint aP4)
aP1-aP2
contains the line segment
aP3-aP4
.aP1
- start point of the first line segment.aP2
- end point of the first line segment.aP3
- start point of the second line segment.aP4
- end point of the second line segment.public static boolean contains2DSR(double aLon1, double aLat1, double aWidth1, double aHeight1, double aLon2, double aLat2, double aWidth2, double aHeight2)
aLon1
- longitude of lower left corner point in degrees.aLat1
- latitude of lower left corner point in degrees.aWidth1
- width of the rectangle (>=0) in degrees.aHeight1
- height of the rectangle (>=0) in degrees.aLon2
- longitude of lower left corner point in degrees.aLat2
- latitude of lower left corner point in degrees.aWidth2
- width of the rectangle (>=0) in degrees.aHeight2
- height of the rectangle (>=0) in degrees.public static boolean intersects2DCircleLineSegment(ILcdPoint aCenter, double aRadius, ILcdPoint aP1, ILcdPoint aP2)
aCenter
- lon-lat coordinate of center point.aRadius
- radius of circle expressed in arc degrees.aP1
- end point of line segment.aP2
- end point of line segment.public static boolean intersects2DLineSegmentCircularArc(ILcdPoint aP1, ILcdPoint aP2, ILcdPoint aCenter, double aRadius, double aStartAngle, double aArcAngle)
aP1
- end point of the line segment.aP2
- end point of the line segment.aCenter
- center of the circular arc segment.aRadius
- radius of the circular arc segment in degrees.aStartAngle
- start angle of arc segment expressed in degrees,
positive counter clock wise starting from 3O'Clock.aArcAngle
- length of arc angle in degrees.public static boolean intersects2DCircularArcCircularArc(ILcdPoint aCenter1, double aRadius1, double aStartAngle1, double aArcAngle1, ILcdPoint aCenter2, double aRadius2, double aStartAngle2, double aArcAngle2)
aCenter1
- center point of first circular arc.aRadius1
- radius of first circular arc in degrees.aStartAngle1
- start angle of arc segment expressed in degrees,
positive counter clock wise starting from 3 O'Clock.aArcAngle1
- length of arc in degrees.aCenter2
- center point of second circular arc.aRadius2
- radius of second circular arc in degrees.aStartAngle2
- start angle of arc segment expressed in degrees,
positive counter clock wise starting from 3 O'Clock.aArcAngle2
- length of arc in degrees.public static void bufferContour2DOfSegmentSFCT(ILcdPoint aStartPoint, ILcdPoint aEndPoint, double aWidth, ILcd2DEditablePoint[] a2DEditablePointArraySFCT)
aStartPoint
,
aEndPoint
, and aWidth
, as an array of 4 ILcd2DEditablePoint
objects. The ordering of the points of the contour is clockwise starting
from the first point of the rectangle.
Because there are only 4 points used to define the contour, the contour representation
becomes less accurate when the start and end point are further removed from each other:
the connected contour lines no longer lie at the given distance from the axis at each intermediate point.
For a more accurate calculation of a buffer contour that uses additional contour points if necessary,
please refer to TLcdEllipsoidUtil#computeBufferContour2D
.
aStartPoint
- start point of buffer segment.aEndPoint
- end point of buffer segment.aWidth
- distance from the line segment to the contour in arc degrees.a2DEditablePointArraySFCT
- an initialized array of 4 ILcd2DEditablePoint
objects, which will represent the contour polygon.public static void contour2DOfBoundsSFCT(ILcdBounds aBounds, ILcd2DEditablePoint[] a2DEditablePointArraySFCT)
ILcdBounds
, as an array of
ILcd2DEditablePoint
objects.aBounds
- bounds object.a2DEditablePointArraySFCT
- an initialized array of 4 ILcd2DEditablePoint
which will contain the contour.public static void bufferContour2DOf2DPolyline(ILcdPointList aPointList, double aWidth, ILcd2DEditablePoint[] a2DEditablePointArraySFCT)
ILcdPointList
at a given width. No two successive points should coincide! 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,TLcdEllipsoidUtil#computeBufferContour2D
.
aPointList
- the axis of the buffer.aWidth
- distance from the axis to the contour in arc degrees.a2DEditablePointArraySFCT
- an initialized array of aPointList.getPointCount() * 2
ILcd2DEditablePoint
objects, which will represent
the contour polygon.public static double greatCircleDistance3D(ILcdPoint aPoint1, ILcdPoint aPoint2, double aRadius)
TLcdSphereUtil#greatCircleDistance
, which ignores the height of the points, the distance calculations of this
method take the heights of the given points into account.aPoint1
- the start (geodetic) pointaPoint2
- the end (geodetic) pointaRadius
- the radius of the sphere on which to perform the distance calculation