pub fn auxlat_coeffs(n: f64, auxin: AuxLat, auxout: AuxLat, out: &mut [f64])Expand description
The following routines auxlat_coeffs, polyvol, clenshaw, auxlat_convert (3 signatures) provide a uniform interface for converting between any pair of auxiliary latitudes using series expansions in the third flattening, n. There are 6 (= AuxLat::NUMBER) auxiliary latitudes supported labeled by
AuxLat::GEOGRAPHIC for geographic latitude, phi AuxLat::PARAMETRIC for parametric latitude, beta AuxLat::GEOCENTRIC for geocentric latitude, theta AuxLat::RECTIFYING for rectifying latitude, mu AuxLat::CONFORMAL for conformal latitude, chi AuxLat::AUTHALIC for authlatic latitude, xi
This is adapted from
C. F. F. Karney, On auxiliary latitudes, Survey Review 56, 165-180 (2024) https://doi.org/10.1080/00396265.2023.2217604 Preprint: https://arxiv.org/abs/2212.05818
The typical calling sequence is
constexpr int L = int(AuxLat::ORDER);
// Managing the memory for the coefficent array is the
// responibility of the calling routine.
double F[L];
// Fill F[] with coefficients to convert conformal to geographic
auxlat_coeffs(proj.n, AuxLat::CONFORMAL, AuxLat::GEOGRAPHIC, F);
…
double chi = 1; // known conformal latitude
// compute corresponding geographic latitude
double phi = auxlat_convert(chi, F);
The conversions are Fourier series in the auxiliary latitude where each coefficient is given as a Taylor series in n truncated at order 6 (= AuxLat::ORDER). This suffices to give full double precision accuracy for |f| <= 1/150 and probably provide satisfactory results for |f| <= 1/50. The coefficients for these Taylor series are given by matrics listed in Eqs. (A1-A28) of this paper.
These coefficients are bundled up into a single array coeffs in auxlat_coeffs. Only the upper triangular portion of the matrices are included. Furthermore, half the coefficients for the conversions between any of phi, bete, theta, and mu are zero (the Taylor series are expansions in n^2), these zero elements are excluded.
The coefficent array, coeffs, is machine-generated by the Maxima code auxlat.mac bundled with GeographicLib. To use
- Ensure that l_max (set near the top of the file) is set to 6 (= AuxLat::ORDER).
- run $ maxima Maxima 5.47.0 https://maxima.sourceforge.io (%i1) load(“auxlat.mac”)$ (%i2) writecppproj()$ …. “CLOSED OUTPUT BUFFERED FILE-STREAM CHARACTER auxvalsproj6.cpp”
- The results are in the file auxvalsproj6.cpp
Only a subset of the conversion matrices are written out. To add others, include them in the list “required” in writecppproj(). The conversions currently supported are
phi <-> mu for meridian distance phi <-> chi for tmerc phi <-> xi for authalic latitude conversions chi <-> mu for tmerc
Because all the matrices are concatenated together into a single array, coeff, an auxiliary array, ptrs, or length 37 = AUXNUMBER^2 + 1, is written out to give the starting point of any particular matrix.
Input:
n – the third flattening (a-b)/(a+b)
auxin, auxout – compute the coefficients for converting auxin (zeta) to
auxout (eta).
Output:
F – F[eta,zeta] = C[eta,zeta]. P(n), where C is a matrix of constants
and P(n) = [n, n^2, n^3, ...]^T; the first AuxLat::ORDER elements of F
are filled.