Skip to content

Commit

Permalink
Merge 15e5a2c into 91be24d
Browse files Browse the repository at this point in the history
  • Loading branch information
kbevers committed Dec 20, 2017
2 parents 91be24d + 15e5a2c commit f3892f3
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src/PJ_ccon.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,33 +25,35 @@
#include <proj.h>
#include "projects.h"

#define EPS10 1e-10

struct pj_opaque {
double phi1;
double ctgphi1;
double sinphi1;
double cosphi1;
double *en;
double *en;
};

PROJ_HEAD(ccon, "Central Conic")
"\n\tCentral Conic, Sph.\n\tlat_1=";



static XY forward (LP lp, PJ *P) {
static XY forward (LP lp, PJ *P) {
XY xy = {0.0,0.0};
struct pj_opaque *Q = P->opaque;
double r;

r = Q->ctgphi1 - tan(lp.phi - Q->phi1);
xy.x = r * sin(lp.lam * Q->sinphi1);
xy.y = Q->ctgphi1 - r * cos(lp.lam * Q->sinphi1);
xy.y = Q->ctgphi1 - r * cos(lp.lam * Q->sinphi1);

return xy;
}


static LP inverse (XY xy, PJ *P) {
static LP inverse (XY xy, PJ *P) {
LP lp = {0.0,0.0};
struct pj_opaque *Q = P->opaque;

Expand All @@ -63,7 +65,7 @@ static LP inverse (XY xy, PJ *P) {
}


static void *destructor (PJ *P, int errlev) {
static void *destructor (PJ *P, int errlev) {
if (0==P)
return 0;

Expand All @@ -84,9 +86,11 @@ PJ *PROJECTION(ccon) {
P->destructor = destructor;

Q->phi1 = pj_param(P->ctx, P->params, "rlat_1").f;
if (fabs(Q->phi1) < EPS10)
return destructor (P, PJD_ERR_LAT1_IS_ZERO);

if (!(Q->en = pj_enfn(P->es)))
return pj_default_destructor(P, ENOMEM);
return destructor(P, ENOMEM);

Q->sinphi1 = sin(Q->phi1);
Q->cosphi1 = cos(Q->phi1);
Expand All @@ -95,7 +99,7 @@ PJ *PROJECTION(ccon) {

P->inv = inverse;
P->fwd = forward;

return P;
}

Expand Down

0 comments on commit f3892f3

Please sign in to comment.