加载中...
搜索中...
无匹配项
offset_scale_cartesian_coordinates.cuh
前往此文件的文档。
1/*
2 * 版权所有 (c) 2023, NVIDIA CORPORATION。
3 *
4 * 根据 Apache 许可证 2.0 版(“许可证”)获得许可;
5 * 除非符合许可证的规定,否则您不得使用此文件。
6 * 您可以在以下位置获取许可证副本:
7 *
8 * https://apache.ac.cn/licenses/LICENSE-2.0
9 *
10 * 除非适用法律要求或书面同意,否则软件
11 * 在许可证下分发是基于“原样”基础的,
12 * 不附带任何明示或暗示的保证或条件。
13 * 有关特定语言的权限和限制,请参阅许可证。
14 *
15 */
16
17#pragma once
18
19#include <cuproj/detail/utility/cuda.hpp>
20#include <cuproj/ellipsoid.hpp>
23
24#include <thrust/iterator/transform_iterator.h>
25
26#include <algorithm>
27
28namespace cuproj {
29
34
42template <typename Coordinate, typename T = typename Coordinate::value_type>
44 public
52 : a_(params.ellipsoid_.a), ra_(T{1.0} / a_), x0_(params.x0), y0_(params.y0)
53 {
54 }
55
63 CUPROJ_HOST_DEVICE Coordinate operator()(Coordinate const& coord, direction dir) const
64 {
65 if (dir == direction::FORWARD)
66 return forward(coord);
67 else
68 return inverse(coord);
69 }
70
71 private
79 CUPROJ_HOST_DEVICE Coordinate forward(Coordinate const& coord) const
80 {
81 return coord * a_ + Coordinate{x0_, y0_};
82 };
83
91 CUPROJ_HOST_DEVICE Coordinate inverse(Coordinate const& coord) const
92 {
93 return (coord - Coordinate{x0_, y0_}) * ra_;
94 };
95
96 T a_; // 椭球体半长轴
97 T ra_; // 椭球体半长轴的倒数
98 T x0_; // 投影原点 x
99 T y0_; // 投影原点 y
100};
101
105
106} // namespace cuproj
CUPROJ_HOST_DEVICE Coordinate operator()(Coordinate const &coord, direction dir) const
偏移和缩放单个坐标。
CUPROJ_HOST_DEVICE offset_scale_cartesian_coordinates(projection_parameters< T > const ¶ms)
构造函数。
所有变换操作的基类。
direction
列举了变换操作的方向。