Class TLcdSphereRhumblineUtil
- Since:
- 8.3.02
-
Method Summary
Modifier and TypeMethodDescriptionstatic doubleclosestPointOnRhumbline(ILcdPoint aP1, ILcdPoint aP2, ILcdPoint aP3, double aRadius, double aRelativeTolerance, double aAbsoluteTolerance, ILcd2DEditablePoint aResultSFCT) Finds the shortest rhumb distance from pointaP3to the rhumbline segmentaP1-aP2to within an accuracy ofmax( aAbsoluteTolerance, aRelativeTolerance * rhumblineDistance(aP1,aP2) ).static doubleclosestPointOnRhumblineGeodesic(ILcdPoint aP1, ILcdPoint aP2, ILcdPoint aP3, double aRadius, double aRelativeTolerance, double aAbsoluteTolerance, ILcd2DEditablePoint aResultSFCT) Finds the shortest geodesic distance from pointaP3to the rhumbline segmentaP1-aP2to within an accuracy ofmax( aAbsoluteTolerance, aRelativeTolerance * rhumblineDistance(aP1,aP2) ).static doubleclosestPointOnShape(ILcdPoint aPoint, ILcdShape aShape, double aRadius, double aRelativeTolerance, double aAbsoluteTolerance, ILcd2DEditablePoint aResultSFCT) Finds the shortest rhumb distance from the given point to the given shape, measured on a sphere of the given radius.static doubleclosestPointOnShape(ILcdPoint aPoint, ILcdShape aShape, double aRelativeTolerance, double aAbsoluteTolerance, ILcd2DEditablePoint aResultSFCT) Deprecated.static doubleclosestPointOnShape(ILcdPoint aPoint, ILcdShape aShape, double aRadius, ILcd2DEditablePoint aResultSFCT) Finds the shortest rhumb distance from the given point to the given shape, measured on a sphere of the given radius.static doubleclosestPointOnShape(ILcdPoint aPoint, ILcdShape aShape, ILcd2DEditablePoint aResultSFCT) Deprecated.UseclosestPointOnShape(ILcdPoint, ILcdShape, double, ILcd2DEditablePoint), which takes the sphere radius explicitly.static doubleclosestPointsBetweenShapes(ILcdShape aShape1, ILcdShape aShape2, double aRadius, double aRelativeTolerance, double aAbsoluteTolerance, List<TLcdLonLatLine> aResultSFCT) Finds the shortest rhumb distance between two shapes, measured on a sphere of the given radius, and the connecting segment(s) that realize it, to within the given tolerances.static doubleclosestPointsBetweenShapes(ILcdShape aShape1, ILcdShape aShape2, double aRadius, List<TLcdLonLatLine> aResultSFCT) Finds the shortest rhumb distance between two shapes, measured on a sphere of the given radius, and the connecting segment(s) that realize it.static booleancontains2D(ILcdPoint aP1, ILcdPoint aP2, ILcdPoint aPoint) Checks if the pointaPointlies on the rhumb line betweenaP1andaP2.static booleancontains2DLS(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 intintersection2DLineSegments(ILcdPoint aP1, ILcdPoint aP2, ILcdPoint aP3, ILcdPoint aP4, ILcd2DEditablePoint aResult1SFCT, ILcd2DEditablePoint aResult2SFCT) Computes the intersection of two rhumb lines.static intintersectionGeodesicRhumblineSFCT(ILcdPoint aP1, ILcdPoint aP2, ILcdPoint aP3, ILcdPoint aP4, ILcd2DEditablePoint[] aPointsSFCT) Computes the intersection points of a geodesic and a rhumb line.static booleanintersects2DLS(ILcdPoint aP1, ILcdPoint aP2, ILcdPoint aP3, ILcdPoint aP4) Checks if two rhumb lines intersect.static booleanintersectsGeodesicRhumbline(ILcdPoint aP1, ILcdPoint aP2, ILcdPoint aP3, ILcdPoint aP4) Checks if a geodesic and a rhumb line intersect.static booleanpolygonContains2D(ILcdPolygon aPolygon, double aLonP, double aLatP) Checks if a point lies inside a polygon.static doublerhumblineAzimuth2D(ILcdPoint aP1, ILcdPoint aP2) Returns the azimuth of the rhumbline path fromaP1toaP2in DEGREES.static doublerhumblineDistance(ILcdPoint aP1, ILcdPoint aP2, double aRadius) Returns the distance of the rhumbline path fromaP1toaP2in meters.static doublerhumblineDistance3D(ILcdPoint aPoint1, ILcdPoint aPoint2, double aRadius) Calculates the rhumbline distance to go from point p1 to point p2.static voidrhumblinePointSFCT(ILcdPoint aPoint, double aDistance, double aAzimuth, double aRadius, ILcd2DEditablePoint aRhumblinePointSFCT) Determines theILcdPointaRhumblinePointSFCTon the rhumbline through(aP1.getX(), aP1.getY())located at a distanceaDistanceand forward azimuthaAzimuth.static voidrhumblinePointSFCT(ILcdPoint aP1, ILcdPoint aP2, double aK, ILcd2DEditablePoint aRhumblinePoint) Calculates the rhumbline point at a fractionaKof the rhumbline distance between two pointsaP1andaP2.
-
Method Details
-
contains2D
Checks if the pointaPointlies on the rhumb line betweenaP1andaP2.- 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
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
Checks if a point lies inside a polygon. We define the point with coordinatesaLonP,aLatPto 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
- 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
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
ILcd2DEditablePointobjects 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,0is returned. If the geodesic and rhumb line share an interval of points,-1is returned. In this case, aPointsSFCT contains the two end points of this interval. - Throws:
IndexOutOfBoundsException- If the length ofaPointsSFCTis smaller than the number of intersection points.
-
rhumblineAzimuth2D
Returns the azimuth of the rhumbline path fromaP1toaP2in DEGREES.- Parameters:
aP1- a first point defining the rhumbline pathaP2- a second point defining the rhumbline path- Returns:
- the azimuth of the rhumbline path from
aP1toaP2in DEGREES.
-
rhumblineDistance
Returns the distance of the rhumbline path fromaP1toaP2in meters.- Parameters:
aP1- a first point defining the rhumbline pathaP2- a second point defining the rhumbline pathaRadius- the radius of the sphere.- Returns:
- the distance of the rhumbline path from
aP1toaP2in meters
-
rhumblinePointSFCT
public static void rhumblinePointSFCT(ILcdPoint aPoint, double aDistance, double aAzimuth, double aRadius, ILcd2DEditablePoint aRhumblinePointSFCT) Determines theILcdPointaRhumblinePointSFCTon the rhumbline through(aP1.getX(), aP1.getY())located at a distanceaDistanceand forward azimuthaAzimuth.- Parameters:
aPoint-ILcdPointon the sphere.aDistance- the distance expressed in metersaAzimuth- the forward azimuth expressed in degreesaRadius- the radius of the sphere.aRhumblinePointSFCT- the point in which the calculated point will be stored.- See Also:
-
rhumblinePointSFCT
public static void rhumblinePointSFCT(ILcdPoint aP1, ILcdPoint aP2, double aK, ILcd2DEditablePoint aRhumblinePoint) Calculates the rhumbline point at a fractionaKof the rhumbline distance between two pointsaP1andaP2.- Parameters:
aP1- the first point of the rhumb lineaP2- the second point of the rhumb lineaK- the fraction of the rhumbline distance betweenaP1andaP2aRhumblinePoint- the resulting point
-
closestPointOnShape
@Deprecated public static double closestPointOnShape(ILcdPoint aPoint, ILcdShape aShape, ILcd2DEditablePoint aResultSFCT) Deprecated.UseclosestPointOnShape(ILcdPoint, ILcdShape, double, ILcd2DEditablePoint), which takes the sphere radius explicitly.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 method supports
rhumbandgeodesicILcdPolylineandILcdPolygoninstances, as well asILcdCircleandILcdPointinstances.ILcdShapeListandILcdComplexPolygoninstances are unwrapped, and the closest point over all of their parts is returned.Polygons and circles are treated as their boundary (outline), not as a filled area: for a point inside a polygon or circle, the distance to its boundary is returned.
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)This method uses a default absolute tolerance of 1.0 (meters) and a default relative tolerance of 1e-10.
The distance is returned in meters measured on a sphere of radius
TLcdConstant.EARTH_RADIUS. UseclosestPointOnShape(ILcdPoint, ILcdShape, double, ILcd2DEditablePoint)to measure on a sphere of a given radius.- Parameters:
aPoint- the starting pointaShape- the shape for which to find the point closest to aPointaResultSFCT- side-effect parameter for the resulting point- Returns:
- the shortest distance in meters, on a sphere of radius
TLcdConstant.EARTH_RADIUS - Throws:
IllegalArgumentException- if the provided shape is not supported
-
closestPointOnShape
@Deprecated public static double closestPointOnShape(ILcdPoint aPoint, ILcdShape aShape, double aRelativeTolerance, double aAbsoluteTolerance, ILcd2DEditablePoint aResultSFCT) Deprecated.UseclosestPointOnShape(ILcdPoint, ILcdShape, double, double, double, ILcd2DEditablePoint), which takes the sphere radius explicitly. This overload measures on a sphere ofTLcdConstant.EARTH_RADIUS.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 method supports
rhumbandgeodesicILcdPolylineandILcdPolygoninstances, as well asILcdCircleandILcdPointinstances.ILcdShapeListandILcdComplexPolygoninstances are unwrapped, and the closest point over all of their parts is returned.Polygons and circles are treated as their boundary (outline), not as a filled area: for a point inside a polygon or circle, the distance to its boundary is returned.
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)The distance is returned in meters measured on a sphere of radius
TLcdConstant.EARTH_RADIUS. UseclosestPointOnShape(ILcdPoint, ILcdShape, double, double, double, ILcd2DEditablePoint)to measure on a sphere of a given radius.- Parameters:
aPoint- the starting pointaShape- the shape for which to find the point closest to aPointaRelativeTolerance- relative tolerance (w.r.t. the parts that make up the shape, like a segment of a polyline).aAbsoluteTolerance- absolute tolerance (in meters).aResultSFCT- side-effect parameter for the resulting point- Returns:
- the shortest distance in meters, on a sphere of radius
TLcdConstant.EARTH_RADIUS - Throws:
IllegalArgumentException- if the provided shape is not supported- Since:
- 2026.1
-
closestPointOnShape
public static double closestPointOnShape(ILcdPoint aPoint, ILcdShape aShape, double aRadius, ILcd2DEditablePoint aResultSFCT) Finds the shortest rhumb distance from the given point to the given shape, measured on a sphere of the given radius. The corresponding point on the shape is returned in the side effect parameter.This method supports
rhumbandgeodesicILcdPolylineandILcdPolygoninstances, as well asILcdCircleandILcdPointinstances.ILcdShapeListandILcdComplexPolygoninstances are unwrapped, and the closest point over all of their parts is returned.Polygons and circles are treated as their boundary (outline), not as a filled area: for a point inside a polygon or circle, the distance to its boundary is returned.
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)This method calls
closestPointOnShape(ILcdPoint, ILcdShape, double, double, double, ILcd2DEditablePoint)with a default relative tolerance of 1e-10 and a default absolute tolerance of 1.0 (meters).- Parameters:
aPoint- the starting pointaShape- the shape for which to find the point closest to aPointaRadius- the radius of the sphere on which to perform the calculation (meters)aResultSFCT- side-effect parameter for the resulting point- Returns:
- the shortest distance in meters
- Throws:
IllegalArgumentException- if the provided shape is not supported- Since:
- 2026.1.01
-
closestPointOnShape
public static double closestPointOnShape(ILcdPoint aPoint, ILcdShape aShape, double aRadius, double aRelativeTolerance, double aAbsoluteTolerance, ILcd2DEditablePoint aResultSFCT) Finds the shortest rhumb distance from the given point to the given shape, measured on a sphere of the given radius. The corresponding point on the shape is returned in the side effect parameter.This method supports
rhumbandgeodesicILcdPolylineandILcdPolygoninstances, as well asILcdCircleandILcdPointinstances.ILcdShapeListandILcdComplexPolygoninstances are unwrapped, and the closest point over all of their parts is returned.Polygons and circles are treated as their boundary (outline), not as a filled area: for a point inside a polygon or circle, the distance to its boundary is returned.
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 pointaShape- the shape for which to find the point closest to aPointaRadius- the radius of the sphere on which to perform the calculation (meters)aRelativeTolerance- relative tolerance (w.r.t. the parts that make up the shape, like a segment of a polyline).aAbsoluteTolerance- absolute tolerance (in meters).aResultSFCT- side-effect parameter for the resulting point- Returns:
- the shortest distance in meters
- Throws:
IllegalArgumentException- if the provided shape is not supported- Since:
- 2026.1.01
-
closestPointsBetweenShapes
public static double closestPointsBetweenShapes(ILcdShape aShape1, ILcdShape aShape2, double aRadius, List<TLcdLonLatLine> aResultSFCT) Finds the shortest rhumb distance between two shapes, measured on a sphere of the given radius, and the connecting segment(s) that realize it. The distance is returned in meters and each connecting segment is aTLcdLonLatLine.
See
TLcdEllipsoidUtil.closestPointsBetweenShapes(ILcdShape, ILcdShape, ILcdEllipsoid, List)for the full contract, the supported shape types, the result-list semantics (typically one segment, more for touching, tied or continuum configurations) and the documented limitations.This method calls
closestPointsBetweenShapes(ILcdShape, ILcdShape, double, double, double, List)with a default relative tolerance of 1e-10 and a default absolute tolerance of 1.0 (meters).- Parameters:
aShape1- the first shapeaShape2- the second shapeaRadius- the radius of the sphere on which to perform the calculation (meters)aResultSFCT- side-effect parameter that receives the connecting segment(s); cleared first- Returns:
- the shortest rhumb distance (meters)
- Throws:
IllegalArgumentException- if either shape is of an unsupported type- Since:
- 2026.1.01
-
closestPointsBetweenShapes
public static double closestPointsBetweenShapes(ILcdShape aShape1, ILcdShape aShape2, double aRadius, double aRelativeTolerance, double aAbsoluteTolerance, List<TLcdLonLatLine> aResultSFCT) Finds the shortest rhumb distance between two shapes, measured on a sphere of the given radius, and the connecting segment(s) that realize it, to within the given tolerances. SeeclosestPointsBetweenShapes(ILcdShape, ILcdShape, double, List)andTLcdEllipsoidUtil.closestPointsBetweenShapes(ILcdShape, ILcdShape, ILcdEllipsoid, List)for the full contract and the documented limitations.- Parameters:
aShape1- the first shapeaShape2- the second shapeaRadius- the radius of the sphere on which to perform the calculation (meters)aRelativeTolerance- relative tolerance (w.r.t. the parts that make up the shapes)aAbsoluteTolerance- absolute tolerance (in meters)aResultSFCT- side-effect parameter that receives the connecting segment(s); cleared first- Returns:
- the shortest rhumb distance (meters)
- Throws:
IllegalArgumentException- if either shape is of an unsupported type- Since:
- 2026.1.01
-
closestPointOnRhumbline
public static double closestPointOnRhumbline(ILcdPoint aP1, ILcdPoint aP2, ILcdPoint aP3, double aRadius, double aRelativeTolerance, double aAbsoluteTolerance, ILcd2DEditablePoint aResultSFCT) Finds the shortest rhumb distance from pointaP3to the rhumbline segmentaP1-aP2to within an accuracy ofmax( aAbsoluteTolerance, aRelativeTolerance * rhumblineDistance(aP1,aP2) ). The corresponding point on the rhumbline segment is returned in the side effect parameteraResultSFCT.- 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 pointaP3.- Returns:
- the rhumbline distance from point
aP3to the rhumbline segmentaP1-aP2(meters).
-
closestPointOnRhumblineGeodesic
public static double closestPointOnRhumblineGeodesic(ILcdPoint aP1, ILcdPoint aP2, ILcdPoint aP3, double aRadius, double aRelativeTolerance, double aAbsoluteTolerance, ILcd2DEditablePoint aResultSFCT) Finds the shortest geodesic distance from pointaP3to the rhumbline segmentaP1-aP2to within an accuracy ofmax( aAbsoluteTolerance, aRelativeTolerance * rhumblineDistance(aP1,aP2) ). The corresponding point on the rhumbline segment is returned in the side effect parameteraResultSFCT.- 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 pointaP3.- Returns:
- the geodesic distance from point
aP3to the rhumbline segmentaP1-aP2(meters).
-
rhumblineDistance3D
Calculates the rhumbline distance to go from point p1 to point p2. UnlikeTLcdSphereRhumblineUtil#rhumblineDistance, 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) pointaPoint2- the end (geodetic) pointaRadius- the radius of the sphere on which to perform the distance calculation- Returns:
- the 3D distance of the line segment formed by aPoint1 and aPoint2
- Since:
- 2022.1
-
closestPointOnShape(ILcdPoint, ILcdShape, double, double, double, ILcd2DEditablePoint), which takes the sphere radius explicitly.