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
nightly (24.12)
nightly (24.12)
stable (24.10)
legacy (24.08)
Loading...
Searching...
No Matches
include
cuproj
operation
offset_scale_cartesian_coordinates.cuh
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 <cuproj/detail/utility/cuda.hpp>
20
#include <
cuproj/ellipsoid.hpp
>
21
#include <
cuproj/operation/operation.cuh
>
22
#include <
cuproj/projection_parameters.hpp
>
23
24
#include <thrust/iterator/transform_iterator.h>
25
26
#include <algorithm>
27
28
namespace
cuproj {
29
42
template
<
typename
Coordinate,
typename
T =
typename
Coordinate::value_type>
43
class
offset_scale_cartesian_coordinates
:
operation
<Coordinate> {
44
public
:
51
CUPROJ_HOST_DEVICE
offset_scale_cartesian_coordinates
(
projection_parameters<T>
const
& params)
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_;
// ellipsoid semi-major axis
97
T ra_;
// inverse of ellipsoid semi-major axis
98
T x0_;
// projection origin x
99
T y0_;
// projection origin y
100
};
101
106
}
// namespace cuproj
cuproj::offset_scale_cartesian_coordinates
Given Cartesian coordinates (x, y) in meters, offset and scale them to the projection's origin and sc...
Definition
offset_scale_cartesian_coordinates.cuh:43
cuproj::offset_scale_cartesian_coordinates::operator()
CUPROJ_HOST_DEVICE Coordinate operator()(Coordinate const &coord, direction dir) const
Offset and scale a single coordinate.
Definition
offset_scale_cartesian_coordinates.cuh:63
cuproj::offset_scale_cartesian_coordinates::offset_scale_cartesian_coordinates
CUPROJ_HOST_DEVICE offset_scale_cartesian_coordinates(projection_parameters< T > const ¶ms)
Constructor.
Definition
offset_scale_cartesian_coordinates.cuh:51
cuproj::operation
Base class for all transform operations.
Definition
operation.cuh:63
ellipsoid.hpp
cuproj::direction
direction
Enumerates the direction of a transform operation.
Definition
operation.cuh:44
operation.cuh
projection_parameters.hpp
cuproj::projection_parameters
Projection parameters.
Definition
projection_parameters.hpp:42
Generated by
1.11.0