2022.1.09

• ```public class TLcdSphereRhumblineUtil
extends Object```
Utility for a series of specific topology calculations with rhumblines on the sphere.
Since:
8.3.02
• ### Method Summary

All Methods
Modifier and Type Method and Description
`static double` ```closestPointOnRhumbline(ILcdPoint aP1, ILcdPoint aP2, ILcdPoint aP3, double aRadius, double aRelativeTolerance, double aAbsoluteTolerance, ILcd2DEditablePoint aResultSFCT)```
Finds the shortest rhumb distance from point `aP3` to the rhumbline segment `aP1-aP2` to within an accuracy of `max( aAbsoluteTolerance, aRelativeTolerance * rhumblineDistance(aP1,aP2) )`.
`static double` ```closestPointOnRhumblineGeodesic(ILcdPoint aP1, ILcdPoint aP2, ILcdPoint aP3, double aRadius, double aRelativeTolerance, double aAbsoluteTolerance, ILcd2DEditablePoint aResultSFCT)```
Finds the shortest geodesic distance from point `aP3` to the rhumbline segment `aP1-aP2` to within an accuracy of `max( aAbsoluteTolerance, aRelativeTolerance * rhumblineDistance(aP1,aP2) )`.
`static double` ```closestPointOnShape(ILcdPoint aPoint, ILcdShape aShape, ILcd2DEditablePoint aResultSFCT)```
Finds the shortest rhumb distance from the given point to the given shape.
`static boolean` ```contains2D(ILcdPoint aP1, ILcdPoint aP2, ILcdPoint aPoint)```
Checks if the point `aPoint` lies on the rhumb line between `aP1` and `aP2`.
`static boolean` ```contains2DLS(ILcdPoint aP1, ILcdPoint aP2, ILcdPoint aP3, ILcdPoint aP4)```
Checks if the rhumb line between aP1 and aP2 contains the rhumb line between aP3 and aP4.
`static int` ```intersection2DLineSegments(ILcdPoint aP1, ILcdPoint aP2, ILcdPoint aP3, ILcdPoint aP4, ILcd2DEditablePoint aResult1SFCT, ILcd2DEditablePoint aResult2SFCT)```
Computes the intersection of two rhumb lines.
`static int` ```intersectionGeodesicRhumblineSFCT(ILcdPoint aP1, ILcdPoint aP2, ILcdPoint aP3, ILcdPoint aP4, ILcd2DEditablePoint[] aPointsSFCT)```
Computes the intersection points of a geodesic and a rhumb line.
`static boolean` ```intersects2DLS(ILcdPoint aP1, ILcdPoint aP2, ILcdPoint aP3, ILcdPoint aP4)```
Checks if two rhumb lines intersect.
`static boolean` ```intersectsGeodesicRhumbline(ILcdPoint aP1, ILcdPoint aP2, ILcdPoint aP3, ILcdPoint aP4)```
Checks if a geodesic and a rhumb line intersect.
`static boolean` ```polygonContains2D(ILcdPolygon aPolygon, double aLonP, double aLatP)```
Checks if a point lies inside a polygon.
`static double` ```rhumblineAzimuth2D(ILcdPoint aP1, ILcdPoint aP2)```
Returns the azimuth of the rhumbline path from `aP1` to `aP2` in DEGREES.
`static double` ```rhumblineDistance(ILcdPoint aP1, ILcdPoint aP2, double aRadius)```
Returns the distance of the rhumbline path from `aP1` to `aP2` in meters.
`static double` ```rhumblineDistance3D(ILcdPoint aPoint1, ILcdPoint aPoint2, double aRadius)```
Calculates the rhumbline distance to go from point p1 to point p2.
`static void` ```rhumblinePointSFCT(ILcdPoint aPoint, double aDistance, double aAzimuth, double aRadius, ILcd2DEditablePoint aRhumblinePointSFCT)```
Determines the `ILcdPoint` `aRhumblinePointSFCT` on the rhumbline through `(aP1.getX(), aP1.getY())` located at a distance `aDistance` and forward azimuth `aAzimuth`.
`static void` ```rhumblinePointSFCT(ILcdPoint aP1, ILcdPoint aP2, double aK, ILcd2DEditablePoint aRhumblinePoint)```
Calculates the rhumbline point at a fraction `aK` of the rhumbline distance between two points `aP1` and `aP2`.
• ### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`
• ### Method Detail

• #### contains2D

```public static boolean contains2D(ILcdPoint aP1,
ILcdPoint aP2,
ILcdPoint aPoint)```
Checks if the point `aPoint` lies on the rhumb line between `aP1` and `aP2`.
Parameters:
`aP1` - start point of the rhumb line.
`aP2` - end point of the rhumb line.
`aPoint` - point to be checked.
Returns:
true if the point is on the rhumb line, false otherwise.
• #### contains2DLS

```public static boolean contains2DLS(ILcdPoint aP1,
ILcdPoint aP2,
ILcdPoint aP3,
ILcdPoint aP4)```
Checks if the rhumb line between aP1 and aP2 contains the rhumb line between aP3 and aP4.
Parameters:
`aP1` - start point of the first rhumb line.
`aP2` - end point of the first rhumb line.
`aP3` - start point of the second rhumb line.
`aP4` - end point of the second rhumb line.
Returns:
true if the first rhumb line contains the second, false otherwise.
• #### polygonContains2D

```public static boolean polygonContains2D(ILcdPolygon aPolygon,
double aLonP,
double aLatP)```
Checks if a point lies inside a polygon. We define the point with coordinates `aLonP`,`aLatP` to be inside if:
• the point interacts with the polygon bounds
• the point 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
The polygon thus shouldn't be larger than a hemisphere.
Parameters:
`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.
Returns:
true if the point lies inside the polygon, false otherwise.
• #### intersects2DLS

```public static boolean intersects2DLS(ILcdPoint aP1,
ILcdPoint aP2,
ILcdPoint aP3,
ILcdPoint aP4)```
Checks if two rhumb lines intersect.
Parameters:
`aP1` - start point of the first rhumb line.
`aP2` - end point of the first rhumb line.
`aP3` - start point of the second rhumb line.
`aP4` - end point of the second rhumb line.
Returns:
true if the two rhumb lines intersect, false otherwise.
• #### intersection2DLineSegments

```public static int intersection2DLineSegments(ILcdPoint aP1,
ILcdPoint aP2,
ILcdPoint aP3,
ILcdPoint aP4,
ILcd2DEditablePoint aResult1SFCT,
ILcd2DEditablePoint aResult2SFCT)```
Computes the intersection of two rhumb lines.

The method has two `ILcd2DEditablePoint` objects as side effect parameters containing the result. They are filled in depending on the return value of the method.

Parameters:
`aP1` - the start point of the first rhumb line.
`aP2` - the end point of the first rhumb line.
`aP3` - the start point of the second rhumb line.
`aP4` - the end point of the second rhumb line.
`aResult1SFCT` - the intersection point (or an end point of the interval of overlapping points).
`aResult2SFCT` - if there is an interval of overlapping points, this contains one of the end points.
Returns:
• 0: no intersection between the two rhumb lines
• 1: the rhumb lines have one intersection point
• -1: the two rhumb lines share an interval of points
• #### intersectsGeodesicRhumbline

```public static boolean intersectsGeodesicRhumbline(ILcdPoint aP1,
ILcdPoint aP2,
ILcdPoint aP3,
ILcdPoint aP4)```
Checks if a geodesic and a rhumb line intersect.
Parameters:
`aP1` - start point of the geodesic.
`aP2` - end point of the geodesic.
`aP3` - start point of the rhumb line.
`aP4` - end point of the rhumb line.
Returns:
true if the geodesic and rhumbline intersect, false otherwise.
• #### intersectionGeodesicRhumblineSFCT

```public static int intersectionGeodesicRhumblineSFCT(ILcdPoint aP1,
ILcdPoint aP2,
ILcdPoint aP3,
ILcdPoint aP4,
ILcd2DEditablePoint[] aPointsSFCT)```
Computes the intersection points of a geodesic and a rhumb line. The result is filled in the given point array. The number of intersection points is returned as an integer.
Parameters:
`aP1` - the start point of the geodesic.
`aP2` - the end point of the geodesic.
`aP3` - the start point of the rhumb line.
`aP4` - the end point of the rhumb line.
`aPointsSFCT` - The array of points in which the results should be stored.
Returns:
The number of intersection points (> 0). If no intersection is found, `0` is returned. If the geodesic and rhumb line share an interval of points, `-1` is returned. In this case, aPointsSFCT contains the two end points of this interval.
Throws:
`IndexOutOfBoundsException` - If the length of `aPointsSFCT` is smaller than the number of intersection points.
• #### rhumblineAzimuth2D

```public static double rhumblineAzimuth2D(ILcdPoint aP1,
ILcdPoint aP2)```
Returns the azimuth of the rhumbline path from `aP1` to `aP2` in DEGREES.
Parameters:
`aP1` - a first point defining the rhumbline path
`aP2` - a second point defining the rhumbline path
Returns:
the azimuth of the rhumbline path from `aP1` to `aP2` in DEGREES.
• #### rhumblineDistance

```public static double rhumblineDistance(ILcdPoint aP1,
ILcdPoint aP2,
Returns the distance of the rhumbline path from `aP1` to `aP2` in meters.
Parameters:
`aP1` - a first point defining the rhumbline path
`aP2` - a second point defining the rhumbline path
`aRadius` - the radius of the sphere.
Returns:
the distance of the rhumbline path from `aP1` to `aP2` in meters
• #### rhumblinePointSFCT

```public static void rhumblinePointSFCT(ILcdPoint aPoint,
double aAzimuth,
ILcd2DEditablePoint aRhumblinePointSFCT)```
Determines the `ILcdPoint` `aRhumblinePointSFCT` on the rhumbline through `(aP1.getX(), aP1.getY())` located at a distance `aDistance` and forward azimuth `aAzimuth`.
Parameters:
`aPoint` - `ILcdPoint` on the sphere.
`aDistance` - the distance expressed in meters
`aAzimuth` - the forward azimuth expressed in degrees
`aRadius` - the radius of the sphere.
`aRhumblinePointSFCT` - the point in which the calculated point will be stored.
`rhumblineDistance(com.luciad.shape.ILcdPoint, com.luciad.shape.ILcdPoint, double)`
• #### rhumblinePointSFCT

```public static void rhumblinePointSFCT(ILcdPoint aP1,
ILcdPoint aP2,
double aK,
ILcd2DEditablePoint aRhumblinePoint)```
Calculates the rhumbline point at a fraction `aK` of the rhumbline distance between two points `aP1` and `aP2`.
Parameters:
`aP1` - the first point of the rhumb line
`aP2` - the second point of the rhumb line
`aK` - the fraction of the rhumbline distance between `aP1` and `aP2`
`aRhumblinePoint` - the resulting point
• #### closestPointOnShape

```public static double closestPointOnShape(ILcdPoint aPoint,
ILcdShape aShape,
ILcd2DEditablePoint aResultSFCT)```
Finds the shortest rhumb distance from the given point to the given shape. The corresponding point on the shape is returned in the side effect parameter.

This methods supports `rhumb` `ILcdPolyline` and `ILcdPolygon` instances.

For the shortest great circle distance to a rhumb shape, see `TLcdSphereUtil.closestPointOnShape(com.luciad.shape.ILcdPoint, com.luciad.shape.ILcdShape, com.luciad.shape.shape2D.ILcd2DEditablePoint)`

Parameters:
`aPoint` - the starting point
`aShape` - the shape for which to find the point closest to aPoint
`aResultSFCT` - side-effect parameter for the resulting point
Returns:
the shortest distance (meters)
Throws:
`IllegalArgumentException` - if the provided shape is not supported
• #### closestPointOnRhumbline

```public static double closestPointOnRhumbline(ILcdPoint aP1,
ILcdPoint aP2,
ILcdPoint aP3,
double aRelativeTolerance,
double aAbsoluteTolerance,
ILcd2DEditablePoint aResultSFCT)```
Finds the shortest rhumb distance from point `aP3` to the rhumbline segment `aP1-aP2` to within an accuracy of `max( aAbsoluteTolerance, aRelativeTolerance * rhumblineDistance(aP1,aP2) )`. The corresponding point on the rhumbline segment is returned in the side effect parameter `aResultSFCT`.
Parameters:
`aP1` - start point of the rhumbline segment.
`aP2` - end point of the rhumbline segment.
`aP3` - point from which the shortest distance to the line segment is sought.
`aRadius` - the radius of the sphere on which to perform the calculation.
`aRelativeTolerance` - relative tolerance.
`aAbsoluteTolerance` - absolute tolerance.
`aResultSFCT` - contains the point on the rhumbline segment that is the shortest from point `aP3`.
Returns:
the rhumbline distance from point `aP3` to the rhumbline segment `aP1-aP2` (meters).
• #### closestPointOnRhumblineGeodesic

```public static double closestPointOnRhumblineGeodesic(ILcdPoint aP1,
ILcdPoint aP2,
ILcdPoint aP3,
double aRelativeTolerance,
double aAbsoluteTolerance,
ILcd2DEditablePoint aResultSFCT)```
Finds the shortest geodesic distance from point `aP3` to the rhumbline segment `aP1-aP2` to within an accuracy of `max( aAbsoluteTolerance, aRelativeTolerance * rhumblineDistance(aP1,aP2) )`. The corresponding point on the rhumbline segment is returned in the side effect parameter `aResultSFCT`.
Parameters:
`aP1` - start point of the rhumbline segment.
`aP2` - end point of the rhumbline segment.
`aP3` - point from which the shortest distance to the line segment is sought.
`aRadius` - the radius of the sphere on which to perform the calculation.
`aRelativeTolerance` - relative tolerance.
`aAbsoluteTolerance` - absolute tolerance.
`aResultSFCT` - contains the point on the rhumbline segment that is the shortest from point `aP3`.
Returns:
the geodesic distance from point `aP3` to the rhumbline segment `aP1-aP2` (meters).
• #### rhumblineDistance3D

```public static double rhumblineDistance3D(ILcdPoint aPoint1,
ILcdPoint aPoint2,
Calculates the rhumbline distance to go from point p1 to point p2. Unlike `TLcdSphereRhumblineUtil#rhumblineDistance`, 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) point
`aPoint2` - the end (geodetic) point
`aRadius` - the radius of the sphere on which to perform the distance calculation