2023.1.16

• ```public class TLcdEllipsoidUtil
extends Object```
Utility for a series of specific calculations on the ellipsoid.
• ### Constructor Summary

Constructors
Constructor and Description
`TLcdEllipsoidUtil()`
• ### Method Summary

All Methods
Modifier and Type Method and Description
`static void` ```calculateCircleTangentLine(ILcdPoint aPoint, ILcdPoint aCenter, double aRadius, boolean aClockwise, ILcdEllipsoid aEllipsoid, double aAbsoluteTolerance, ILcd2DEditablePoint aTangentialPointSFCT)```
Find the point where a line through the given point aPoint is tangential to the given circle.
`static double` ```closestPointOnGeodesic(ILcdPoint aP1, ILcdPoint aP2, ILcdPoint aP3, ILcdEllipsoid aEllipsoid, double aRelativeTolerance, double aAbsoluteTolerance, ILcd2DEditablePoint aResultSFCT)```
Finds the shortest distance from point `aP3` to the geodesic line segment `aP1-aP2` to within an accuracy of `max( aAbsoluteTolerance, aRelativeTolerance * distance(aP1,aP2) )`.
`static double` ```closestPointOnShape(ILcdPoint aPoint, ILcdShape aShape, ILcdEllipsoid aEllipsoid, ILcd2DEditablePoint aResultSFCT)```
Finds the shortest distance from the given point to the given shape.
`static ILcdComplexPolygon` ```computeBufferContour2D(ILcdGeoBuffer aBuffer, ILcdEllipsoid aEllipsoid)```
Calculates the contour of an `ILcdGeoBuffer` in the geodetic space.
`static ILcdComplexPolygon` ```computeBufferContour2D(ILcdGeoBuffer aBuffer, ILcdEllipsoid aEllipsoid, int aBufferCapsPrecision)```
Calculates the contour of an `ILcdGeoBuffer` in the geodetic space.
`static double` ```conformalSphericalLatitudeMollweide(ILcdEllipsoid aEllipsoid, double aLatitude)```
Mollweide solution for conformal spherical latitude of a given geodetic latitude.
`static double` ```conformalSphericalLatitudeMollweide(ILcdEllipsoid aEllipsoid, double aLatitude, double aCosLat, double aSinLat)```
Mollweide solution for conformal spherical latitude of a given geodetic latitude.
`static boolean` ```contains2D(ILcdEllipsoid aEllipsoid, ILcdPoint aP1, ILcdPoint aP2, ILcdPoint aPoint)```
Checks if the point `aPoint` lies on the geodesic between `aP1` and `aP2`.
`static boolean` ```contains2DLS(ILcdEllipsoid aEllipsoid, ILcdPoint aP1, ILcdPoint aP2, ILcdPoint aP3, ILcdPoint aP4)```
Checks if the geodesic `aP1-aP2` contains the geodesic `aP3-aP4`.
`static double` ```geodesicArea(ILcdPoint[] aPts, int aN, ILcdEllipsoid aEllipsoid)```
Geodesic surface area of a polygon on the ellipsoid.
`static double` ```geodesicArea(ILcdShape aShape, ILcdEllipsoid aEllipsoid)```
Calculates the geodesic area of a shape.
`static double` ```geodesicDistance3D(ILcdPoint aPoint1, ILcdPoint aPoint2, ILcdEllipsoid aEllipsoid)```
Calculates the distance to go from point p1 to point p2.
`static void` ```geodesicDistanceAndForwardAzimuth(ILcdPoint aLonLatPoint1, ILcdPoint aLonLatPoint2, ILcdEllipsoid aEllipsoid, double[] aResultSFCT)```
Calculates the geodesic distance between the two points and the forward azimuth (in radians).
`static int` ```intersection2DLineSegments(ILcdPoint aP1, ILcdPoint aP2, ILcdPoint aP3, ILcdPoint aP4, ILcdEllipsoid aEllipsoid, double aAbsoluteTolerance, ILcd2DEditablePoint aResult1SFCT, ILcd2DEditablePoint aResult2SFCT)```
Calculates the intersection of two geodesic line segments defined by the given points.
`static void` ```intersection2DLSSFCT(ILcdPoint aP1, ILcdPoint aP2, ILcdPoint aP3, ILcdPoint aP4, ILcdEllipsoid aEllipsoid, ILcd2DEditablePoint aLLResultSFCT)```
`static int` ```intersectionCircleCircle(ILcdPoint aC1, double aRadius1, ILcdPoint aC2, double aRadius2, ILcdEllipsoid aEllipsoid, ILcd2DEditablePoint aResult1SFCT, ILcd2DEditablePoint aResult2SFCT)```
Calculates the intersection points between 2 circles which are defined on a given ellipsoid.
`static void` ```intersectionGeodesicGeodesic(ILcdPoint aP1, ILcdPoint aP2, ILcdPoint aP3, ILcdPoint aP4, ILcdEllipsoid aEllipsoid, ILcd2DEditablePoint aLLResultSFCT)```
Calculates the intersection point of two great circle lines (geodesics) defined by the given points.
`static boolean` ```intersects2DLS(ILcdEllipsoid aEllipsoid, ILcdPoint aP1, ILcdPoint aP2, ILcdPoint aP3, ILcdPoint aP4)```
Checks whether two geodesic line segments intersect.
`static double` ```inverseConformalSphericalLatitudeMollweide(ILcdEllipsoid aEllipsoid, double aLatitude)```
Mollweide solution for inverse conformal spherical latitude of a geodetic latitude.
`static double` ```inverseConformalSphericalLatitudeMollweideDirect(ILcdEllipsoid aEllipsoid, double aLatitude)```
Mollweide solution for inverse conformal spherical latitude of a geodetic latitude.
`static double` ```inverseConformalSphericalLatitudeMollweideDirect(ILcdEllipsoid aEllipsoid, double aLatitude, double aCosLat, double aSinLat)```
Mollweide solution for inverse conformal spherical latitude of a geodetic latitude.
`static int` ```orientation2D(ILcdPoint[] aPoints, int aNumberOfPoints, ILcdEllipsoid aEllipsoid)```
Calculates the orientation of an array of points on an ellipsoid.
`static int` ```orientation2D(ILcdPointList aPointList, ILcdEllipsoid aEllipsoid)```
Calculates the orientation of a point list on the ellipsoid.
• ### Methods inherited from class java.lang.Object

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

• #### TLcdEllipsoidUtil

`public TLcdEllipsoidUtil()`
• ### Method Detail

• #### geodesicDistanceAndForwardAzimuth

```public static void geodesicDistanceAndForwardAzimuth(ILcdPoint aLonLatPoint1,
ILcdPoint aLonLatPoint2,
ILcdEllipsoid aEllipsoid,
double[] aResultSFCT)```
Calculates the geodesic distance between the two points and the forward azimuth (in radians).
Parameters:
`aLonLatPoint1` - start point of the geodesic.
`aLonLatPoint2` - end point of the geodesic.
`aEllipsoid` - ellipsoid on which the geodesic is defined.
`aResultSFCT` - contains the result of the calculation as a side effect. The geodesic distance is at index 0 and the forward azimuth (radians) is at index 1 . The length of the array is required to be at least of length 2 .
• #### contains2D

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

```public static boolean contains2DLS(ILcdEllipsoid aEllipsoid,
ILcdPoint aP1,
ILcdPoint aP2,
ILcdPoint aP3,
ILcdPoint aP4)```
Checks if the geodesic `aP1-aP2` contains the geodesic `aP3-aP4`.
Parameters:
`aEllipsoid` - ellipsoid on which the geodesics are defined.
`aP1` - start point of the first geodesic.
`aP2` - end point of the first geodesic.
`aP3` - start point of the second geodesic.
`aP4` - end point of the second geodesic.
Returns:
true if the first geodesic contains the second, false otherwise.
• #### conformalSphericalLatitudeMollweide

```public static double conformalSphericalLatitudeMollweide(ILcdEllipsoid aEllipsoid,
double aLatitude)```
Mollweide solution for conformal spherical latitude of a given geodetic latitude. Solution taken from Bugayevskiy and Snyder, Map Projections, a reference manual , 1995, pp. 33-35.
Parameters:
`aEllipsoid` - ellipsoid considered.
`aLatitude` - latitude, in degrees.
Returns:
conformal spherical latitude for the given geodetic latitude.
• #### conformalSphericalLatitudeMollweide

```public static double conformalSphericalLatitudeMollweide(ILcdEllipsoid aEllipsoid,
double aLatitude,
double aCosLat,
double aSinLat)```
Mollweide solution for conformal spherical latitude of a given geodetic latitude. Solution taken from Bugayevskiy and Snyder, Map Projections, a reference manual , 1995, pp. 33-35.
Parameters:
`aEllipsoid` - ellipsoid considered.
`aLatitude` - latitude, in degrees.
`aCosLat` - the cosine of the latitude.
`aSinLat` - the sine of the latitude.
Returns:
conformal spherical latitude for the given geodetic latitude.
• #### inverseConformalSphericalLatitudeMollweide

```public static double inverseConformalSphericalLatitudeMollweide(ILcdEllipsoid aEllipsoid,
double aLatitude)```
Mollweide solution for inverse conformal spherical latitude of a geodetic latitude. Iterative procedure. Solution taken from Bugayevskiy and Snyder, Map Projections, a reference manual , 1995, pp. 33-35.
Parameters:
`aEllipsoid` - ellipsoid considered.
`aLatitude` - latitude, in degrees.
Returns:
inverse conformal spherical latitude.
• #### inverseConformalSphericalLatitudeMollweideDirect

```public static double inverseConformalSphericalLatitudeMollweideDirect(ILcdEllipsoid aEllipsoid,
double aLatitude)```
Mollweide solution for inverse conformal spherical latitude of a geodetic latitude. Direct solution because of series expansion to avoid iterative procedure.
Parameters:
`aEllipsoid` - ellipsoid considered.
`aLatitude` - latitude, in degrees.
Returns:
inverse conformal spherical latitude.
`inverseConformalSphericalLatitudeMollweideDirect(ILcdEllipsoid, double, double, double)`
• #### inverseConformalSphericalLatitudeMollweideDirect

```public static double inverseConformalSphericalLatitudeMollweideDirect(ILcdEllipsoid aEllipsoid,
double aLatitude,
double aCosLat,
double aSinLat)```
Mollweide solution for inverse conformal spherical latitude of a geodetic latitude. Direct solution because of series expansion to avoid iterative procedure.
Parameters:
`aEllipsoid` - ellipsoid considered.
`aLatitude` - latitude, in degrees.
`aCosLat` - the cosine of the latitude.
`aSinLat` - the sine of the latitude.
Returns:
inverse conformal spherical latitude.
• #### closestPointOnShape

```public static double closestPointOnShape(ILcdPoint aPoint,
ILcdShape aShape,
ILcdEllipsoid aEllipsoid,
ILcd2DEditablePoint aResultSFCT)```
Finds the shortest 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` and `geodesic` `ILcdPolyline` and `ILcdPolygon` instances.

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

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

```public static int intersection2DLineSegments(ILcdPoint aP1,
ILcdPoint aP2,
ILcdPoint aP3,
ILcdPoint aP4,
ILcdEllipsoid aEllipsoid,
double aAbsoluteTolerance,
ILcd2DEditablePoint aResult1SFCT,
ILcd2DEditablePoint aResult2SFCT)```
Calculates the intersection of two geodesic line segments defined by the given points. Any intersection will always lie on both segments (i.e. between aP1 and aP2, and between aP3 and aP4).

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.

Refer to `intersectionGeodesicGeodesic(com.luciad.shape.ILcdPoint, com.luciad.shape.ILcdPoint, com.luciad.shape.ILcdPoint, com.luciad.shape.ILcdPoint, com.luciad.geodesy.ILcdEllipsoid, com.luciad.shape.shape2D.ILcd2DEditablePoint)` for checking the intersection of entire geodesics.

Parameters:
`aP1` - the start point of the first geodesic.
`aP2` - the end point of the first geodesic.
`aP3` - the start point of the second geodesic.
`aP4` - the end point of the second geodesic.
`aEllipsoid` - the ellipsoid on which the points are defined.
`aAbsoluteTolerance` - the tolerance allowed on the result.
`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 geodesics
• 1: the geodetics have one intersection point
• -1: the two geodetics share an interval of points
• #### intersectionGeodesicGeodesic

```public static void intersectionGeodesicGeodesic(ILcdPoint aP1,
ILcdPoint aP2,
ILcdPoint aP3,
ILcdPoint aP4,
ILcdEllipsoid aEllipsoid,
ILcd2DEditablePoint aLLResultSFCT)
throws IllegalArgumentException```
Calculates the intersection point of two great circle lines (geodesics) defined by the given points. See `intersection2DLineSegments(com.luciad.shape.ILcdPoint, com.luciad.shape.ILcdPoint, com.luciad.shape.ILcdPoint, com.luciad.shape.ILcdPoint, com.luciad.geodesy.ILcdEllipsoid, double, 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.

Parameters:
`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.
`aEllipsoid` - the ellipsoid
`aLLResultSFCT` - the intersection point as side effect.
Throws:
`IllegalArgumentException` - if no intersection point can be found or chosen.
Since:
2021.0
• #### computeBufferContour2D

```public static ILcdComplexPolygon computeBufferContour2D(ILcdGeoBuffer aBuffer,
ILcdEllipsoid aEllipsoid)```
Calculates the contour of an `ILcdGeoBuffer` in the geodetic space.

This method directly calls the `computeBufferContour2D(ILcdGeoBuffer, ILcdEllipsoid, int)` method. See the javadoc of that method from more information.

This method uses a buffer caps precision of 8.
Parameters:
`aBuffer` - the buffer for which the contour must be calculated.
`aEllipsoid` - the ellipsoid on which to perform the calculations.
Returns:
the contour of the buffer.
• #### computeBufferContour2D

```public static ILcdComplexPolygon computeBufferContour2D(ILcdGeoBuffer aBuffer,
ILcdEllipsoid aEllipsoid,
int aBufferCapsPrecision)```
Calculates the contour of an `ILcdGeoBuffer` in the geodetic 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.

It is possible to control the number of points that are inserted for (rounded) caps or joins using the `aBufferCapsPrecision` parameter. This can for example be used to improve rendering performance when you show a large amount of buffers on the view.

The calculated contour should preferably not be used in combination with layers that use a geodetic pen with straightLineMode enabled (see `TLcdGeodeticPen.isStraightLineMode()`) because the contour is always calculated in geodetic space, the rendering of the axis could intersect with the contour if it is drawn in cartesian mode.

Parameters:
`aBuffer` - the buffer for which the contour must be calculated.
`aEllipsoid` - the ellipsoid on which to perform the calculations.
`aBufferCapsPrecision` - the precision represents the amount of edges per quarter-circle used for discretization of caps and joins. The value must be larger than 0, and is typically 8. When passing a value of 1, the cap or join will consist of only 1 edge. Using larger values will lead to rounder, smoother results. Recommended values are in the range of 1 to 12.
Returns:
the contour of the buffer.
Throws:
`IllegalArgumentException` - when aBufferCapsPrecision is smaller than 1
Since:
2022.1
• #### geodesicArea

```public static double geodesicArea(ILcdPoint[] aPts,
int aN,
ILcdEllipsoid aEllipsoid)```
Geodesic surface area of a polygon on the ellipsoid.

Constraints: (`aN` > 2) and (`aPts.length >= aN`).

This is an approximation based on the spherical formulae using a Gaussian radius.

Parameters:
`aPts` - array of `ILcdPoint` objects.
`aN` - `aPts[0..aN-1]` defines the polygon on the sphere.
`aEllipsoid` - an ellipsoid
Returns:
the surface area in meter2. Positive for counterclockwise polygons, negative otherwise.
• #### orientation2D

```public static int orientation2D(ILcdPoint[] aPoints,
int aNumberOfPoints,
ILcdEllipsoid aEllipsoid)```
Calculates the orientation of an array of points on an ellipsoid.

Constraints: (`aNumberOfPoints` > 2) and (`aPoints.length >= aNumberOfPoints`).

Parameters:
`aPoints` - array of `ILcdPoint` objects (first point is not repeated).
`aNumberOfPoints` - the number of points of the array to take into account.
`aEllipsoid` - an ellipsoid.
Returns:
the orientation of the polygon. Possible return values are ILcdPolygon#CLOCKWISE and ILcdPolygon#COUNTERCLOCKWISE.
• #### orientation2D

```public static int orientation2D(ILcdPointList aPointList,
ILcdEllipsoid aEllipsoid)```
Calculates the orientation of a point list on the ellipsoid.

Constraints: (`aPointList.length > 2`).

Parameters:
`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.
`aEllipsoid` - an ellipsoid.
Returns:
the orientation of the polygon which would be described by the point list. Possible return values are `ILcdPolygon.CLOCKWISE` and `ILcdPolygon.COUNTERCLOCKWISE`.
• #### intersectionCircleCircle

```public static int intersectionCircleCircle(ILcdPoint aC1,
ILcdPoint aC2,
ILcdEllipsoid aEllipsoid,
ILcd2DEditablePoint aResult1SFCT,
ILcd2DEditablePoint aResult2SFCT)```
Calculates the intersection points between 2 circles which are defined on a given ellipsoid. If no intersections are found, none of the given points are adjusted. If only 1 intersection is found only the first point is adjusted. When 2 intersections are found, both points are adjusted.
Parameters:
`aC1` - Center point of the first circle
`aRadius1` - Radius of the first circle
`aC2` - Center point of the second circle
`aRadius2` - Radius of the second circle
`aEllipsoid` - The ellipsoid on which the circles are located
`aResult1SFCT` - The first intersection
`aResult2SFCT` - The second intersection
Returns:
The number of intersections found.
• #### calculateCircleTangentLine

```public static void calculateCircleTangentLine(ILcdPoint aPoint,
ILcdPoint aCenter,
boolean aClockwise,
ILcdEllipsoid aEllipsoid,
double aAbsoluteTolerance,
ILcd2DEditablePoint aTangentialPointSFCT)
throws IllegalArgumentException```
Find the point where a line through the given point aPoint is tangential to the given circle. This point is uniquely defined because we only look in a 90-degree range, starting from the direction from the center of the circle to the given point. On which side of this direction to look is defined by the `aClockwise` parameter.
Parameters:
`aPoint` - Given point outside of circle.
`aCenter` - Center of given circle.
`aRadius` - Radius of the given circle.
`aClockwise` - Look in clockwise direction starting from direction to aPoint
`aEllipsoid` - the ellipsoid on which calculations are performed.
`aAbsoluteTolerance` - the allowed tolerance for the result. This tolerance is used to compare azimuths, so it should be specified in radians. The value may be 0.0 to cause the method to find a solution as accurate as possible. Note that in this case, it is possible that no solution is found. It is advised to always specify a tolerance, for example 1e-10.
`aTangentialPointSFCT` - The resulting point, if found.
Throws:
`IllegalArgumentException` - if there is no circle center such that the touching points would be on the respective line segments.
• #### geodesicDistance3D

```public static double geodesicDistance3D(ILcdPoint aPoint1,
ILcdPoint aPoint2,
ILcdEllipsoid aEllipsoid)```
Calculates the distance to go from point p1 to point p2. Unlike `ILcdEllipsoid#geodesicDistance`, which ignores the height of the points, the distance calculations of this method take the heights of the given points into account.
Parameters:
`aPoint1` - the start (geodetic) point
`aPoint2` - the end (geodetic) point
`aEllipsoid` - the ellipsoid on which to perform the distance calculation
Returns:
the 3D distance of the line segment formed by aPoint1 and aPoint2
Since:
2022.1