public class TLcdEllipsoidUtil extends Object
Constructor and Description |
---|
TLcdEllipsoidUtil() |
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)
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.geodesy.ILcdEllipsoid, com.luciad.shape.shape2D.ILcd2DEditablePoint) |
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.
|
public static void geodesicDistanceAndForwardAzimuth(ILcdPoint aLonLatPoint1, ILcdPoint aLonLatPoint2, ILcdEllipsoid aEllipsoid, double[] aResultSFCT)
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 .public static boolean contains2D(ILcdEllipsoid aEllipsoid, ILcdPoint aP1, ILcdPoint aP2, ILcdPoint aPoint)
aPoint
lies on the geodesic between
aP1
and aP2
.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.public static boolean contains2DLS(ILcdEllipsoid aEllipsoid, ILcdPoint aP1, ILcdPoint aP2, ILcdPoint aP3, ILcdPoint aP4)
aP1-aP2
contains the geodesic
aP3-aP4
.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.public static boolean intersects2DLS(ILcdEllipsoid aEllipsoid, ILcdPoint aP1, ILcdPoint aP2, ILcdPoint aP3, ILcdPoint aP4)
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.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.true
if the segments intersect each other, false
otherwise.public static double conformalSphericalLatitudeMollweide(ILcdEllipsoid aEllipsoid, double aLatitude)
aEllipsoid
- ellipsoid considered.aLatitude
- latitude, in degrees.public static double conformalSphericalLatitudeMollweide(ILcdEllipsoid aEllipsoid, double aLatitude, double aCosLat, double aSinLat)
aEllipsoid
- ellipsoid considered.aLatitude
- latitude, in degrees.aCosLat
- the cosine of the latitude.aSinLat
- the sine of the latitude.public static double inverseConformalSphericalLatitudeMollweide(ILcdEllipsoid aEllipsoid, double aLatitude)
aEllipsoid
- ellipsoid considered.aLatitude
- latitude, in degrees.public static double inverseConformalSphericalLatitudeMollweideDirect(ILcdEllipsoid aEllipsoid, double aLatitude)
aEllipsoid
- ellipsoid considered.aLatitude
- latitude, in degrees.inverseConformalSphericalLatitudeMollweideDirect(ILcdEllipsoid, double, double, double)
public static double inverseConformalSphericalLatitudeMollweideDirect(ILcdEllipsoid aEllipsoid, double aLatitude, double aCosLat, double aSinLat)
aEllipsoid
- ellipsoid considered.aLatitude
- latitude, in degrees.aCosLat
- the cosine of the latitude.aSinLat
- the sine of the latitude.public static double closestPointOnShape(ILcdPoint aPoint, ILcdShape aShape, ILcdEllipsoid aEllipsoid, ILcd2DEditablePoint aResultSFCT)
This methods supports rhumb
and geodesic
ILcdPolyline
and ILcdPolygon
instances.
aPoint
- the starting pointaShape
- the shape for which to find the point closest to aPointaEllipsoid
- the ellipsoid on which to perform the calculationaResultSFCT
- side-effect parameter for the resulting pointIllegalArgumentException
- if the provided shape is not supportedpublic static double closestPointOnGeodesic(ILcdPoint aP1, ILcdPoint aP2, ILcdPoint aP3, ILcdEllipsoid aEllipsoid, double aRelativeTolerance, double aAbsoluteTolerance, ILcd2DEditablePoint aResultSFCT)
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
.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
.aP3
to the
geodesic line segment aP1-aP2
(meters).public static int intersection2DLineSegments(ILcdPoint aP1, ILcdPoint aP2, ILcdPoint aP3, ILcdPoint aP4, ILcdEllipsoid aEllipsoid, double aAbsoluteTolerance, ILcd2DEditablePoint aResult1SFCT, ILcd2DEditablePoint aResult2SFCT)
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.
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.@Deprecated public static void intersection2DLSSFCT(ILcdPoint aP1, ILcdPoint aP2, ILcdPoint aP3, ILcdPoint aP4, ILcdEllipsoid aEllipsoid, ILcd2DEditablePoint aLLResultSFCT) throws IllegalArgumentException
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)
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.
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 ellipsoidaLLResultSFCT
- 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, ILcdEllipsoid aEllipsoid, ILcd2DEditablePoint aLLResultSFCT) throws IllegalArgumentException
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.
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 ellipsoidaLLResultSFCT
- the intersection point as side effect.IllegalArgumentException
- if no intersection point can be found or chosen.public static ILcdComplexPolygon computeBufferContour2D(ILcdGeoBuffer aBuffer, ILcdEllipsoid aEllipsoid)
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.aBuffer
- the buffer for which the contour must be calculated.aEllipsoid
- the ellipsoid on which to perform the calculations.public static ILcdComplexPolygon computeBufferContour2D(ILcdGeoBuffer aBuffer, ILcdEllipsoid aEllipsoid, int aBufferCapsPrecision)
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.
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.IllegalArgumentException
- when aBufferCapsPrecision is smaller than 1public static double geodesicArea(ILcdPoint[] aPts, int aN, ILcdEllipsoid aEllipsoid)
Constraints: (aN
> 2) and (aPts.length >= aN
).
This is an approximation based on the spherical formulae using a Gaussian radius.
aPts
- array of ILcdPoint
objects.aN
- aPts[0..aN-1]
defines the polygon on the sphere.aEllipsoid
- an ellipsoidpublic static double geodesicArea(ILcdShape aShape, ILcdEllipsoid aEllipsoid)
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 aboveaEllipsoid
- ellipsoid on which to calculate the surface areaTLcdSphereUtil.geodesicArea(ILcdShape, double)
,
TLcdCartesian.area(ILcdShape)
public static int orientation2D(ILcdPoint[] aPoints, int aNumberOfPoints, ILcdEllipsoid aEllipsoid)
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.aEllipsoid
- an ellipsoid.public static int orientation2D(ILcdPointList aPointList, ILcdEllipsoid aEllipsoid)
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.aEllipsoid
- an ellipsoid.ILcdPolygon.CLOCKWISE
and
ILcdPolygon.COUNTERCLOCKWISE
.public static int intersectionCircleCircle(ILcdPoint aC1, double aRadius1, ILcdPoint aC2, double aRadius2, ILcdEllipsoid aEllipsoid, ILcd2DEditablePoint aResult1SFCT, ILcd2DEditablePoint aResult2SFCT)
aC1
- Center point of the first circleaRadius1
- Radius of the first circleaC2
- Center point of the second circleaRadius2
- Radius of the second circleaEllipsoid
- The ellipsoid on which the circles are locatedaResult1SFCT
- The first intersectionaResult2SFCT
- The second intersectionpublic static void calculateCircleTangentLine(ILcdPoint aPoint, ILcdPoint aCenter, double aRadius, boolean aClockwise, ILcdEllipsoid aEllipsoid, double aAbsoluteTolerance, ILcd2DEditablePoint aTangentialPointSFCT) throws IllegalArgumentException
aClockwise
parameter.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 aPointaEllipsoid
- 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.IllegalArgumentException
- if there is no circle center such that the touching points
would be on the respective line segments.public static double geodesicDistance3D(ILcdPoint aPoint1, ILcdPoint aPoint2, ILcdEllipsoid aEllipsoid)
ILcdEllipsoid#geodesicDistance
, 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) pointaEllipsoid
- the ellipsoid on which to perform the distance calculation