Tuesday, March 23, 2004
Examining the proj source code (free license / public domain) takes me back a few years to the joys of preprocessors and c/c++.
Architecture so far:
Application assembles a projection constants structure from command line arguments and defaults supplied in the code. The bits we need to worry about are the mercator projection in PJ_merc and the Clarke66 elliptical constants defined in pj_ellps.c
The ellipsoid is specified by the length of its semimajor axis (a=6378206.4, radius at equator) and the length of its semiminor axis (b=6356583.8, radius to pole). The code in pj_ell_set extends these into equivalent expressions of a and es (eccentricity squared, I think). From these, pj_init fills in other useful values (e, 1-es, 1/(1-es)) which get stored in the projection constants structure.
Using the very useful -E option in gcc to perform preprocessor substitutions and make the code more legible.
T