Coverage Report

Created: 2025-06-13 06:18

/src/proj/src/conversions/geocent.cpp
Line
Count
Source (jump to first uncovered line)
1
/******************************************************************************
2
 * Project:  PROJ.4
3
 * Purpose:  Stub projection for geocentric.  The transformation isn't
4
 *           really done here since this code is 2D.  The real transformation
5
 *           is handled by pj_transform.c.
6
 * Author:   Frank Warmerdam, warmerdam@pobox.com
7
 *
8
 ******************************************************************************
9
 * Copyright (c) 2002, Frank Warmerdam
10
 *
11
 * Permission is hereby granted, free of charge, to any person obtaining a
12
 * copy of this software and associated documentation files (the "Software"),
13
 * to deal in the Software without restriction, including without limitation
14
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
15
 * and/or sell copies of the Software, and to permit persons to whom the
16
 * Software is furnished to do so, subject to the following conditions:
17
 *
18
 * The above copyright notice and this permission notice shall be included
19
 * in all copies or substantial portions of the Software.
20
 *
21
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
22
 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
24
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
27
 * DEALINGS IN THE SOFTWARE.
28
 *****************************************************************************/
29
30
#include "proj.h"
31
#include "proj_internal.h"
32
33
PROJ_HEAD(geocent, "Geocentric") "\n\t";
34
35
0
static PJ_XY forward(PJ_LP lp, PJ *P) {
36
0
    PJ_XY xy = {0.0, 0.0};
37
0
    (void)P;
38
0
    xy.x = lp.lam;
39
0
    xy.y = lp.phi;
40
0
    return xy;
41
0
}
42
43
0
static PJ_LP inverse(PJ_XY xy, PJ *P) {
44
0
    PJ_LP lp = {0.0, 0.0};
45
0
    (void)P;
46
0
    lp.phi = xy.y;
47
0
    lp.lam = xy.x;
48
0
    return lp;
49
0
}
50
51
0
PJ *PJ_CONVERSION(geocent, 0) {
52
0
    P->is_geocent = 1;
53
0
    P->x0 = 0.0;
54
0
    P->y0 = 0.0;
55
0
    P->inv = inverse;
56
0
    P->fwd = forward;
57
0
    P->left = PJ_IO_UNITS_RADIANS;
58
0
    P->right = PJ_IO_UNITS_CARTESIAN;
59
60
0
    return P;
61
0
}