Vulcan
Aerospace Engineering Utilities Built on Janus
Loading...
Searching...
No Matches
vulcan::geodetic Namespace Reference

Classes

struct  RayIntersection
 Result of ray-ellipsoid intersection. More...

Functions

template<typename Scalar>
Scalar haversine_distance (const LLA< Scalar > &lla1, const LLA< Scalar > &lla2, double radius=constants::earth::R_mean)
template<typename Scalar>
Scalar great_circle_distance (const LLA< Scalar > &lla1, const LLA< Scalar > &lla2, const EarthModel &m=EarthModel::WGS84())
template<typename Scalar>
Scalar initial_bearing (const LLA< Scalar > &lla1, const LLA< Scalar > &lla2, const EarthModel &m=EarthModel::WGS84())
template<typename Scalar>
Scalar final_bearing (const LLA< Scalar > &lla1, const LLA< Scalar > &lla2, const EarthModel &m=EarthModel::WGS84())
template<typename Scalar>
LLA< Scalar > destination_point (const LLA< Scalar > &lla, const Scalar &bearing, const Scalar &distance, const EarthModel &m=EarthModel::WGS84())
template<typename Scalar>
Scalar horizon_distance (const Scalar &altitude, const EarthModel &m=EarthModel::WGS84())
template<typename Scalar>
Scalar is_visible (const LLA< Scalar > &lla_observer, const LLA< Scalar > &lla_target, const EarthModel &m=EarthModel::WGS84())
template<typename Scalar>
RayIntersection< Scalar > ray_ellipsoid_intersection (const Vec3< Scalar > &origin, const Vec3< Scalar > &direction, const EarthModel &m=EarthModel::WGS84())

Function Documentation

◆ destination_point()

template<typename Scalar>
LLA< Scalar > vulcan::geodetic::destination_point ( const LLA< Scalar > & lla,
const Scalar & bearing,
const Scalar & distance,
const EarthModel & m = EarthModel::WGS84() )

Compute destination point given start, bearing, and distance

Uses the Vincenty direct formula to compute the endpoint of a geodesic given start point, initial bearing, and distance along the ellipsoid.

Template Parameters
ScalarScalar type (double for numeric, SymbolicScalar for symbolic)
Parameters
llaStarting point
bearingInitial azimuth [rad], clockwise from North
distanceDistance along ellipsoid [m]
mEarth model (default: WGS84)
Returns
Destination LLA (altitude set to source altitude)

◆ final_bearing()

template<typename Scalar>
Scalar vulcan::geodetic::final_bearing ( const LLA< Scalar > & lla1,
const LLA< Scalar > & lla2,
const EarthModel & m = EarthModel::WGS84() )

Final bearing arriving at point 2 from point 1

Computes the final bearing (back azimuth + π) arriving at point 2. This is the reverse of initial_bearing(lla2, lla1) + π.

Template Parameters
ScalarScalar type (double for numeric, SymbolicScalar for symbolic)
Parameters
lla1First point (start)
lla2Second point (destination)
mEarth model (default: WGS84)
Returns
Azimuth in radians [0, 2π), measured clockwise from North

◆ great_circle_distance()

template<typename Scalar>
Scalar vulcan::geodetic::great_circle_distance ( const LLA< Scalar > & lla1,
const LLA< Scalar > & lla2,
const EarthModel & m = EarthModel::WGS84() )

Great-circle distance using Vincenty formula (accurate to 0.5mm)

Uses Vincenty's inverse formula for geodesic distance on an ellipsoid. This is an iterative algorithm that converges for most point pairs.

Reference: Vincenty, T. (1975). "Direct and inverse solutions of geodesics on the ellipsoid with application of nested equations"

Note: For symbolic mode, uses a fixed iteration count (20 iterations) rather than convergence checking.

Template Parameters
ScalarScalar type (double for numeric, SymbolicScalar for symbolic)
Parameters
lla1First point (altitude ignored)
lla2Second point (altitude ignored)
mEarth model (default: WGS84)
Returns
Distance along ellipsoid surface [m]

◆ haversine_distance()

template<typename Scalar>
Scalar vulcan::geodetic::haversine_distance ( const LLA< Scalar > & lla1,
const LLA< Scalar > & lla2,
double radius = constants::earth::R_mean )

Haversine distance (fast spherical approximation)

Uses the haversine formula for great-circle distance on a sphere. Good for short distances (<100km), error <0.3% compared to Vincenty.

Formula: a = sin²(Δφ/2) + cos(φ₁)cos(φ₂)sin²(Δλ/2) c = 2·atan2(√a, √(1−a)) d = R·c

Template Parameters
ScalarScalar type (double for numeric, SymbolicScalar for symbolic)
Parameters
lla1First point (altitude ignored)
lla2Second point (altitude ignored)
radiusSphere radius [m] (default: WGS84 mean radius)
Returns
Distance along sphere surface [m]

◆ horizon_distance()

template<typename Scalar>
Scalar vulcan::geodetic::horizon_distance ( const Scalar & altitude,
const EarthModel & m = EarthModel::WGS84() )

Distance to geometric horizon from given altitude

Computes the distance along the Earth's surface from a point at altitude h to the geometric horizon (line-of-sight tangent to surface).

For a sphere: d = √(2Rh + h²) For ellipsoid: uses mean radius at given position.

Template Parameters
ScalarScalar type (double for numeric, SymbolicScalar for symbolic)
Parameters
altitudeHeight above ellipsoid [m]
mEarth model (default: WGS84)
Returns
Distance to horizon along surface [m]

◆ initial_bearing()

template<typename Scalar>
Scalar vulcan::geodetic::initial_bearing ( const LLA< Scalar > & lla1,
const LLA< Scalar > & lla2,
const EarthModel & m = EarthModel::WGS84() )

Initial bearing (azimuth) from point 1 to point 2

Computes the initial bearing (forward azimuth) for the geodesic from point 1 to point 2. This is the direction to head from point 1.

Template Parameters
ScalarScalar type (double for numeric, SymbolicScalar for symbolic)
Parameters
lla1First point (start)
lla2Second point (destination)
mEarth model (default: WGS84) – used only for flattening
Returns
Azimuth in radians [0, 2π), measured clockwise from North

◆ is_visible()

template<typename Scalar>
Scalar vulcan::geodetic::is_visible ( const LLA< Scalar > & lla_observer,
const LLA< Scalar > & lla_target,
const EarthModel & m = EarthModel::WGS84() )

Check if target is visible from observer (no terrain, pure geometry)

Uses geometric horizon distance and great-circle arc comparison. Returns a value > 0 if visible, ≤ 0 if not visible.

The visibility check accounts for both observer and target altitudes: visible if horizon_distance(alt1) + horizon_distance(alt2) ≥ ground_distance

Template Parameters
ScalarScalar type (double for numeric, SymbolicScalar for symbolic)
Parameters
lla_observerObserver position
lla_targetTarget position
mEarth model (default: WGS84)
Returns
Positive if visible, zero/negative if occluded by Earth

◆ ray_ellipsoid_intersection()

template<typename Scalar>
RayIntersection< Scalar > vulcan::geodetic::ray_ellipsoid_intersection ( const Vec3< Scalar > & origin,
const Vec3< Scalar > & direction,
const EarthModel & m = EarthModel::WGS84() )

Ray-ellipsoid intersection for terrain/visibility calculations

Computes intersection of ray with WGS84 ellipsoid. Ray: P(t) = origin + t * direction

Ellipsoid equation: (x/a)² + (y/a)² + (z/b)² = 1 Substituting ray equation gives quadratic: At² + Bt + C = 0

Template Parameters
ScalarScalar type (double for numeric, SymbolicScalar for symbolic)
Parameters
originRay origin in ECEF [m]
directionRay direction (will be normalized internally)
mEarth model (default: WGS84)
Returns
RayIntersection with intersection parameters and points