aboutsummaryrefslogtreecommitdiff
path: root/src/PJ_goode.c
diff options
context:
space:
mode:
authorFrank Warmerdam <warmerdam@pobox.com>1999-03-18 16:34:52 +0000
committerFrank Warmerdam <warmerdam@pobox.com>1999-03-18 16:34:52 +0000
commit565a4bd035b9d4a83955808efef20f1d8dfa24cf (patch)
tree75785fc897708023f1ccdaf40079afcbaaf0fd3a /src/PJ_goode.c
downloadPROJ-565a4bd035b9d4a83955808efef20f1d8dfa24cf.tar.gz
PROJ-565a4bd035b9d4a83955808efef20f1d8dfa24cf.zip
New
git-svn-id: http://svn.osgeo.org/metacrs/proj/trunk@776 4e78687f-474d-0410-85f9-8d5e500ac6b2
Diffstat (limited to 'src/PJ_goode.c')
-rw-r--r--src/PJ_goode.c49
1 files changed, 49 insertions, 0 deletions
diff --git a/src/PJ_goode.c b/src/PJ_goode.c
new file mode 100644
index 00000000..d1e6c447
--- /dev/null
+++ b/src/PJ_goode.c
@@ -0,0 +1,49 @@
+#ifndef lint
+static const char SCCSID[]="@(#)PJ_goode.c 4.1 94/02/15 GIE REL";
+#endif
+#define PROJ_PARMS__ \
+ struct PJconsts *sinu; \
+ struct PJconsts *moll;
+#define PJ_LIB__
+#include <projects.h>
+PROJ_HEAD(goode, "Goode Homolosine") "\n\tPCyl, Sph.";
+ extern PJ
+*pj_sinu(PJ *), *pj_moll(PJ *);
+#define Y_COR 0.05280
+#define PHI_LIM .71093078197902358062
+FORWARD(s_forward); /* spheroid */
+ if (fabs(lp.phi) <= PHI_LIM)
+ xy = P->sinu->fwd(lp, P->sinu);
+ else {
+ xy = P->moll->fwd(lp, P->moll);
+ xy.y -= lp.phi >= 0.0 ? Y_COR : -Y_COR;
+ }
+ return (xy);
+}
+INVERSE(s_inverse); /* spheroid */
+ if (fabs(xy.y) <= PHI_LIM)
+ lp = P->sinu->inv(xy, P->sinu);
+ else {
+ xy.y += xy.y >= 0.0 ? Y_COR : -Y_COR;
+ lp = P->moll->inv(xy, P->moll);
+ }
+ return (lp);
+}
+FREEUP;
+ if (P) {
+ if (P->sinu)
+ (*(P->sinu->pfree))(P->sinu);
+ if (P->moll)
+ (*(P->moll->pfree))(P->moll);
+ pj_dalloc(P);
+ }
+}
+ENTRY2(goode, sinu, moll)
+ P->es = 0.;
+ if (!(P->sinu = pj_sinu(0)) || !(P->moll = pj_moll(0)))
+ E_ERROR_0;
+ if (!(P->sinu = pj_sinu(P->sinu)) || !(P->moll = pj_moll(P->moll)))
+ E_ERROR_0;
+ P->fwd = s_forward;
+ P->inv = s_inverse;
+ENDENTRY(P)