Home
libcuproj
cucim
cudf-java
cudf
cugraph
cuml
cuproj
cuspatial
cuvs
cuxfilter
dask-cuda
dask-cudf
kvikio
libcudf
libcuml
libcuproj
libcuspatial
libkvikio
libucxx
raft
rapids-cmake
rmm
stable (24.10)
nightly (24.12)
stable (24.10)
legacy (24.08)
Loading...
Searching...
No Matches
include
cuproj
ellipsoid.hpp
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2023, NVIDIA CORPORATION.
3
*
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
7
*
8
* http://www.apache.org/licenses/LICENSE-2.0
9
*
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
15
*/
16
17
#pragma once
18
19
#include <cassert>
20
#include <cmath>
21
22
namespace
cuproj {
23
34
template
<
typename
T>
35
struct
ellipsoid
{
36
ellipsoid
() =
default
;
37
44
constexpr
ellipsoid
(T a, T inverse_flattening) : a(a)
45
{
46
assert(inverse_flattening != 0.0);
47
b = a * (1. - 1. / inverse_flattening);
48
f = 1.0 / inverse_flattening;
49
es = 2 * f - f * f;
50
e = sqrt(es);
51
alpha = asin(e);
52
n = pow(tan(alpha / 2), 2);
53
}
54
55
T a{};
// semi-major axis
56
T b{};
// semi-minor axis
57
T e{};
// first eccentricity
58
T es{};
// first eccentricity squared
59
T alpha{};
// angular eccentricity
60
T f{};
// flattening
61
T n{};
// third flattening
62
};
63
70
template
<
typename
T>
71
constexpr
ellipsoid<T>
make_ellipsoid_wgs84
()
72
{
73
return
ellipsoid<T>
{T{6378137.0}, T{298.257223563}};
74
}
75
80
}
// namespace cuproj
cuproj::make_ellipsoid_wgs84
constexpr ellipsoid< T > make_ellipsoid_wgs84()
Create the WGS84 ellipsoid.
Definition
ellipsoid.hpp:71
cuproj::ellipsoid
Ellipsoid parameters.
Definition
ellipsoid.hpp:35
cuproj::ellipsoid::ellipsoid
constexpr ellipsoid(T a, T inverse_flattening)
Construct an ellipsoid from semi-major axis and inverse flattening.
Definition
ellipsoid.hpp:44
Generated by
1.10.0