/src/PROJ/src/conversions/geoc.cpp
Line | Count | Source (jump to first uncovered line) |
1 | | /****************************************************************************** |
2 | | * Project: PROJ.4 |
3 | | * Purpose: Conversion from geographic to geocentric latitude and back. |
4 | | * Author: Thomas Knudsen (2017) |
5 | | * |
6 | | ****************************************************************************** |
7 | | * Copyright (c) 2017, SDFE, http://www.sdfe.dk |
8 | | * Copyright (c) 2017, Thomas Knudsen |
9 | | * |
10 | | * Permission is hereby granted, free of charge, to any person obtaining a |
11 | | * copy of this software and associated documentation files (the "Software"), |
12 | | * to deal in the Software without restriction, including without limitation |
13 | | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
14 | | * and/or sell copies of the Software, and to permit persons to whom the |
15 | | * Software is furnished to do so, subject to the following conditions: |
16 | | * |
17 | | * The above copyright notice and this permission notice shall be included |
18 | | * in all copies or substantial portions of the Software. |
19 | | * |
20 | | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
21 | | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
22 | | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
23 | | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
24 | | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
25 | | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
26 | | * DEALINGS IN THE SOFTWARE. |
27 | | *****************************************************************************/ |
28 | | |
29 | | #include <math.h> |
30 | | |
31 | | #include "proj.h" |
32 | | #include "proj_internal.h" |
33 | | |
34 | | PROJ_HEAD(geoc, "Geocentric Latitude"); |
35 | | |
36 | | /* Geographical to geocentric */ |
37 | 0 | static void forward(PJ_COORD &coo, PJ *P) { |
38 | 0 | coo = pj_geocentric_latitude(P, PJ_FWD, coo); |
39 | 0 | } |
40 | | |
41 | | /* Geocentric to geographical */ |
42 | 0 | static void inverse(PJ_COORD &coo, PJ *P) { |
43 | 0 | coo = pj_geocentric_latitude(P, PJ_INV, coo); |
44 | 0 | } |
45 | | |
46 | 125 | static PJ *PJ_CONVERSION(geoc, 1) { |
47 | 125 | P->inv4d = inverse; |
48 | 125 | P->fwd4d = forward; |
49 | | |
50 | 125 | P->left = PJ_IO_UNITS_RADIANS; |
51 | 125 | P->right = PJ_IO_UNITS_RADIANS; |
52 | | |
53 | 125 | P->is_latlong = 1; |
54 | 125 | return P; |
55 | 125 | } |