Coverage Report

Created: 2025-11-24 06:58

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/PROJ/src/projections/wag3.cpp
Line
Count
Source
1
2
3
#include <errno.h>
4
#include <math.h>
5
6
#include "proj.h"
7
#include "proj_internal.h"
8
9
PROJ_HEAD(wag3, "Wagner III") "\n\tPCyl, Sph\n\tlat_ts=";
10
11
35.5k
#define TWOTHIRD 0.6666666666666666666667
12
13
namespace { // anonymous namespace
14
struct pj_wag3 {
15
    double C_x;
16
};
17
} // anonymous namespace
18
19
35.5k
static PJ_XY wag3_s_forward(PJ_LP lp, PJ *P) { /* Spheroidal, forward */
20
35.5k
    PJ_XY xy = {0.0, 0.0};
21
35.5k
    xy.x = static_cast<struct pj_wag3 *>(P->opaque)->C_x * lp.lam *
22
35.5k
           cos(TWOTHIRD * lp.phi);
23
35.5k
    xy.y = lp.phi;
24
35.5k
    return xy;
25
35.5k
}
26
27
0
static PJ_LP wag3_s_inverse(PJ_XY xy, PJ *P) { /* Spheroidal, inverse */
28
0
    PJ_LP lp = {0.0, 0.0};
29
0
    lp.phi = xy.y;
30
0
    lp.lam = xy.x / (static_cast<struct pj_wag3 *>(P->opaque)->C_x *
31
0
                     cos(TWOTHIRD * lp.phi));
32
0
    return lp;
33
0
}
34
35
764
PJ *PJ_PROJECTION(wag3) {
36
764
    double ts;
37
764
    struct pj_wag3 *Q =
38
764
        static_cast<struct pj_wag3 *>(calloc(1, sizeof(struct pj_wag3)));
39
764
    if (nullptr == Q)
40
0
        return pj_default_destructor(P, PROJ_ERR_OTHER /*ENOMEM*/);
41
42
764
    P->opaque = Q;
43
44
764
    ts = pj_param(P->ctx, P->params, "rlat_ts").f;
45
764
    static_cast<struct pj_wag3 *>(P->opaque)->C_x = cos(ts) / cos(2. * ts / 3.);
46
764
    P->es = 0.;
47
764
    P->inv = wag3_s_inverse;
48
764
    P->fwd = wag3_s_forward;
49
50
764
    return P;
51
764
}
52
53
#undef TWOTHIRD