首页
libcuproj
cucim
cudf-java
cudf
cugraph
cuml
cuproj
cuspatial
cuvs
cuxfilter
dask-cuda
dask-cudf
kvikio
libcudf
libcuml
libcuproj
libcuspatial
libkvikio
librmm
libucxx
raft
rapids-cmake
rapidsmpf
rmm
稳定版 (25.04)
每夜构建版 (25.06)
稳定版 (25.04)
旧版 (25.02)
加载中...
搜索中...
无匹配项
include
cuproj
operation
degrees_to_radians.cuh
前往此文件的文档。
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
* https://apache.ac.cn/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 <
cuproj/constants.hpp
>
20
#include <cuproj/detail/utility/cuda.hpp>
21
#include <
cuproj/operation/operation.cuh
>
22
23
namespace
cuproj {
24
29
35
template
<
typename
Coordinate>
36
class
degrees_to_radians
:
operation
<Coordinate> {
37
public
46
CUPROJ_HOST_DEVICE Coordinate
operator()
(Coordinate
const
& coord,
direction
dir)
const
47
{
48
if
(dir == direction::FORWARD)
49
return
forward(coord);
50
else
51
return
inverse(coord);
52
}
53
54
private
61
CUPROJ_HOST_DEVICE Coordinate forward(Coordinate
const
& coord)
const
62
{
63
using
T =
typename
Coordinate::value_type;
64
return
Coordinate{coord.x *
DEG_TO_RAD<T>
, coord.y *
DEG_TO_RAD<T>
};
65
}
66
73
CUPROJ_HOST_DEVICE Coordinate inverse(Coordinate
const
& coord)
const
74
{
75
using
T =
typename
Coordinate::value_type;
76
return
Coordinate{coord.x *
RAD_TO_DEG<T>
, coord.y *
RAD_TO_DEG<T>
};
77
}
78
};
79
83
84
}
// namespace cuproj
cuproj::degrees_to_radians
将度转换为弧度,反之亦然。
定义
degrees_to_radians.cuh:36
cuproj::degrees_to_radians::operator()
CUPROJ_HOST_DEVICE Coordinate operator()(Coordinate const &coord, direction dir) const
将度转换为弧度,反之亦然。
定义
degrees_to_radians.cuh:46
cuproj::operation
所有转换操作的基类。
定义
operation.cuh:63
constants.hpp
cuproj::DEG_TO_RAD
constexpr T DEG_TO_RAD
从度到弧度的转换因子。
定义
constants.hpp:40
cuproj::RAD_TO_DEG
constexpr T RAD_TO_DEG
从弧度到度的转换因子。
定义
constants.hpp:44
cuproj::direction
direction
枚举转换操作的方向。
定义
operation.cuh:44
operation.cuh
生成者
1.13.2