Many applications that deal with geospatial data need to be able to perform various geometric calculations on the data. A
few examples of such calculations are area computation for surfaces, containment and intersection tests, and
distance calculations. LuciadLightspeed offers support for this kind of operations in the packages geodesy
and geometry
. Most of this functionality is specific for the coordinate system or in which the operations are performed. This article
covers ellipsoidal, spherical, and Cartesian calculations, and concludes with a discussion of ILcdSegmentScanner
.
Ellipsoidal calculations
The interface ILcdEllipsoid
defines several geometric calculations that you can perform on the surface of an ellipsoid (see Geodesy). You can perform various additional calculations using TLcdEllipsoidUtil
. The methods of TLcdEllipsoidUtil
all accept an ILcdEllipsoid
as one of their parameters.
TLcdEllipsoidUtil
supports the following operations:

Closest point determination

Containment tests for line segments

Intersection tests for line segments

Conformal latitude computation

Buffer contour construction
Refer to the API reference for more information on TLcdEllipsoidUtil
and its methods.
Spherical calculations
The class TLcdSphereUtil
provides various spherical trigonometry operations.
Whereas TLcdEllipsoidUtil
works on an ellipsoid and returns results measured in meters,
TLcdSphereUtil
works entirely in geodetic coordinates and returns results measured in arc degrees.
Several of TLcdSphereUtil
methods correspond to those found in ILcdEllipsoid
.
Using a spherical instead of an ellipsoidal calculation produces an approximate result, but may be desirable for performance
reasons.
TLcdSphereUtil
supports the following operations:

Various containment and intersection tests

Distance, area, and orientation calculations

Closest point determination

Conversion between Cartesian and geodetic coordinates
Refer to the API reference for more information on TLcdSphereUtil
and its methods.
Cartesian calculations
For operations in Cartesian space, LuciadLightspeed provides the class TLcdCartesian
. Its functionality is, to a large extent, equivalent to TLcdSphereUtil
, although obviously the inputs and outputs of TLcdCartesian
's methods are expressed in Cartesian coordinates rather than geodetic coordinates. Also note that while the majority of methods
operate in 2D space (XY coordinates), some operations are also implemented in 3D (XYZ coordinates). Refer to the API reference
for an overview of the specific methods and their usage.
Sampling line segments
The interface ILcdSegmentScanner
allows you to compute sample points along a line segment. The sample points are at a regular interval. Sampling of line segments
is used to extract the underlying terrain heights for every sample point, for example. See Retrieving height data for 2D points.
With the sample data, you can then construct a profile view of the terrain covered by the line segment, for example.
LuciadLightspeed provides three implementations of ILcdSegmentScanner
:

TLcdGeodeticSegmentScanner
: generates points along a geodetic line 
TLcdRhumblineSegmentScanner
: generates points along a rhumb line, that is, a line of constant azimuth 
TLcdGridSegmentScanner
: generates points along a Cartesian line
The main method of ILcdSegmentScanner
is scanSegment()
, which takes the following arguments:

a distance delta that indicates the desired spacing of the generated points

the start and end point of the line segment from which to generate the points

an
ILcdOnPointFunction
to be invoked for every generated point
All implementations of ILcdSegmentScanner
compute points along the input line segment, and pass each of them in turn to the supplied ILcdOnPointFunction
. Refer to the API reference for further details.