50 : lam0_(params.lam0_), prime_meridian_offset_(params.prime_meridian_offset_)
63 [[nodiscard]] CUPROJ_HOST_DEVICE Coordinate
operator()(Coordinate
const& coord,
66 if (dir == direction::FORWARD)
67 return forward(coord);
69 return inverse(coord);
83 [[nodiscard]] CUPROJ_HOST_DEVICE Coordinate forward(Coordinate
const& coord)
const
86 T t = (coord.y < 0 ? -coord.y : coord.y) - M_PI_2;
90 Coordinate xy = coord;
93 auto half_pi =
static_cast<T
>(M_PI_2);
94 xy.y = clamp(xy.y, -half_pi, half_pi);
97 xy.x = (xy.x - prime_meridian_offset_) - lam0_;
100 xy.x = detail::wrap_to_pi(xy.x);
114 [[nodiscard]]
inline CUPROJ_HOST_DEVICE Coordinate inverse(Coordinate
const& coord)
const
116 Coordinate xy = coord;
119 xy.x += prime_meridian_offset_ + lam0_;
122 xy.x = detail::wrap_to_pi(xy.x);
127 [[nodiscard]]
inline CUPROJ_HOST_DEVICE
const T& clamp(
const T& val,
132 return val < low ? low : (high < val) ? high : val;
136 T prime_meridian_offset_{};