[Proj] patch: move geod functions to proj library and create API to use it
Sergey Spiridonov
sena at hurd.homeunix.org
Tue Dec 5 04:00:36 PST 2006
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi,
Patch in attachment can be applied to proj-4.5.0. To apply the patch:
tar xzf proj-4.5.0.tgz
cd proj-4.5.0
patch -p1 <../proj-4.5.0-geod_api.patch
Following functions were added:
GEODESIC_T *GEOD_init(int, char **, GEODESIC_T *geodesic);
GEODESIC_T *GEOD_init_plus(const char *args, GEODESIC_T *geodesic);
They work the same way as proj_init and proj_init_plus, except that they
accept additional parameter GEODESIC_T *geodesic.
If geodesic is 0, memory for GEODESIC_T will be allocated and pointer to
allocated memory will be returned.
Functions geodetic_for, geod_inv, geod_pre are changed to accept pointer
to the GEODESIC_T. All global variables are moved to this structure.
Functions geod_for, geod_inv, geod_pre become members of the proj library.
I also include changes to Makefile.in, but may be it is better to
regenerate it again (or even exclude from distribution as it is
generated file).
Following 2 functions are not included into the patch, they just make
usage of the geod functions convinient.
void
geod_fwd(GEODESIC_T *GEODESIC, double lon1, double lat1, double S,
double az, double *lon2, double *lat2)
{
GEODESIC->p1.u = lat1;
GEODESIC->p1.v = lon1;
al12 = az;
GEODESIC->DIST = S; //* GEODESIC->FR_METER;
geod_pre(GEODESIC);
geod_for(GEODESIC);
*lat2 = GEODESIC->p2.u;
*lon2 = GEODESIC->p2.v;
}
int
geod_rev(GEODESIC_T *GEODESIC, double lon1, double lat1, double lon2,
double lat2, double *S, double *az)
{
GEODESIC->p1.u = lat1;
GEODESIC->p1.v = lon1;
GEODESIC->p2.u = lat2;
GEODESIC->p2.v = lon2;
int ret = geod_inv(GEODESIC);
if(al12 < 0)
{
al12 += TWOPI;
}
*az = al12;
*S = GEODESIC->DIST; // * GEODESIC->TO_METER;
return ret;
}
Hope it will be useful.
- --
Best regards, Sergey Spiridonov
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFFdV9kJ3NEeIx4r3YRAl2CAKCCDk8Zou1HxDk16fGeO0Hr9o5TzACeL9MI
GYsiBHY5okHWoD/7v1BZhpc=
=R1ND
-----END PGP SIGNATURE-----
-------------- next part --------------
A non-text attachment was scrubbed...
Name: proj-4.5.0-geod_api.patch
Type: text/x-patch
Size: 25746 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/proj/attachments/20061205/22d4c252/attachment.bin>
More information about the Proj
mailing list