From 610957f7035242f15743c399ffd429b92bc36206 Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Tue, 18 Dec 2018 20:24:11 +0100 Subject: cpp conversion: minimal steps to fix compilation errors, not warnings --- src/pj_auth.cpp | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 src/pj_auth.cpp (limited to 'src/pj_auth.cpp') diff --git a/src/pj_auth.cpp b/src/pj_auth.cpp new file mode 100644 index 00000000..d6024671 --- /dev/null +++ b/src/pj_auth.cpp @@ -0,0 +1,36 @@ +/* determine latitude from authalic latitude */ + +#include +#include + +#include "projects.h" + +# define P00 .33333333333333333333 /* 1 / 3 */ +# define P01 .17222222222222222222 /* 31 / 180 */ +# define P02 .10257936507936507937 /* 517 / 5040 */ +# define P10 .06388888888888888888 /* 23 / 360 */ +# define P11 .06640211640211640212 /* 251 / 3780 */ +# define P20 .01677689594356261023 /* 761 / 45360 */ +#define APA_SIZE 3 + + double * +pj_authset(double es) { + double t, *APA; + + if ((APA = (double *)pj_malloc(APA_SIZE * sizeof(double))) != NULL) { + APA[0] = es * P00; + t = es * es; + APA[0] += t * P01; + APA[1] = t * P10; + t *= es; + APA[0] += t * P02; + APA[1] += t * P11; + APA[2] = t * P20; + } + return APA; +} + double +pj_authlat(double beta, double *APA) { + double t = beta+beta; + return(beta + APA[0] * sin(t) + APA[1] * sin(t+t) + APA[2] * sin(t+t+t)); +} -- cgit v1.2.3