annotate DEPENDENCIES/generic/include/boost/geometry/strategies/strategy_transform.hpp @ 133:4acb5d8d80b6 tip

Don't fail environmental check if README.md exists (but .txt and no-suffix don't)
author Chris Cannam
date Tue, 30 Jul 2019 12:25:44 +0100
parents c530137014c0
children
rev   line source
Chris@16 1 // Boost.Geometry (aka GGL, Generic Geometry Library)
Chris@16 2
Chris@16 3 // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
Chris@16 4 // Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
Chris@16 5 // Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
Chris@16 6
Chris@16 7 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
Chris@16 8 // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
Chris@16 9
Chris@16 10 // Use, modification and distribution is subject to the Boost Software License,
Chris@16 11 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
Chris@16 12 // http://www.boost.org/LICENSE_1_0.txt)
Chris@16 13
Chris@16 14 #ifndef BOOST_GEOMETRY_STRATEGIES_STRATEGY_TRANSFORM_HPP
Chris@16 15 #define BOOST_GEOMETRY_STRATEGIES_STRATEGY_TRANSFORM_HPP
Chris@16 16
Chris@16 17 #include <cstddef>
Chris@16 18 #include <cmath>
Chris@16 19 #include <functional>
Chris@16 20
Chris@16 21 #include <boost/numeric/conversion/cast.hpp>
Chris@16 22
Chris@16 23 #include <boost/geometry/algorithms/convert.hpp>
Chris@16 24 #include <boost/geometry/arithmetic/arithmetic.hpp>
Chris@16 25 #include <boost/geometry/core/access.hpp>
Chris@16 26 #include <boost/geometry/core/radian_access.hpp>
Chris@16 27 #include <boost/geometry/core/coordinate_dimension.hpp>
Chris@16 28 #include <boost/geometry/strategies/transform.hpp>
Chris@16 29
Chris@16 30 #include <boost/geometry/util/math.hpp>
Chris@16 31 #include <boost/geometry/util/select_coordinate_type.hpp>
Chris@16 32
Chris@16 33 namespace boost { namespace geometry
Chris@16 34 {
Chris@16 35
Chris@16 36 namespace strategy { namespace transform
Chris@16 37 {
Chris@16 38
Chris@16 39 #ifndef DOXYGEN_NO_DETAIL
Chris@16 40 namespace detail
Chris@16 41 {
Chris@16 42
Chris@16 43 template
Chris@16 44 <
Chris@16 45 typename Src, typename Dst,
Chris@16 46 std::size_t D, std::size_t N,
Chris@16 47 template <typename> class F
Chris@16 48 >
Chris@16 49 struct transform_coordinates
Chris@16 50 {
Chris@16 51 template <typename T>
Chris@16 52 static inline void transform(Src const& source, Dst& dest, T value)
Chris@16 53 {
Chris@16 54 typedef typename select_coordinate_type<Src, Dst>::type coordinate_type;
Chris@16 55
Chris@16 56 F<coordinate_type> function;
Chris@16 57 set<D>(dest, boost::numeric_cast<coordinate_type>(function(get<D>(source), value)));
Chris@16 58 transform_coordinates<Src, Dst, D + 1, N, F>::transform(source, dest, value);
Chris@16 59 }
Chris@16 60 };
Chris@16 61
Chris@16 62 template
Chris@16 63 <
Chris@16 64 typename Src, typename Dst,
Chris@16 65 std::size_t N,
Chris@16 66 template <typename> class F
Chris@16 67 >
Chris@16 68 struct transform_coordinates<Src, Dst, N, N, F>
Chris@16 69 {
Chris@16 70 template <typename T>
Chris@16 71 static inline void transform(Src const& , Dst& , T )
Chris@16 72 {
Chris@16 73 }
Chris@16 74 };
Chris@16 75
Chris@16 76 } // namespace detail
Chris@16 77 #endif // DOXYGEN_NO_DETAIL
Chris@16 78
Chris@16 79
Chris@16 80 /*!
Chris@16 81 \brief Transformation strategy to copy one point to another using assignment operator
Chris@16 82 \ingroup transform
Chris@16 83 \tparam P point type
Chris@16 84 */
Chris@16 85 template <typename P>
Chris@16 86 struct copy_direct
Chris@16 87 {
Chris@16 88 inline bool apply(P const& p1, P& p2) const
Chris@16 89 {
Chris@16 90 p2 = p1;
Chris@16 91 return true;
Chris@16 92 }
Chris@16 93 };
Chris@16 94
Chris@16 95 /*!
Chris@16 96 \brief Transformation strategy to do copy a point, copying per coordinate.
Chris@16 97 \ingroup transform
Chris@16 98 \tparam P1 first point type
Chris@16 99 \tparam P2 second point type
Chris@16 100 */
Chris@16 101 template <typename P1, typename P2>
Chris@16 102 struct copy_per_coordinate
Chris@16 103 {
Chris@16 104 inline bool apply(P1 const& p1, P2& p2) const
Chris@16 105 {
Chris@16 106 // Defensive check, dimensions are equal, selected by specialization
Chris@16 107 assert_dimension_equal<P1, P2>();
Chris@16 108
Chris@16 109 geometry::convert(p1, p2);
Chris@16 110 return true;
Chris@16 111 }
Chris@16 112 };
Chris@16 113
Chris@16 114
Chris@16 115 /*!
Chris@16 116 \brief Transformation strategy to go from degree to radian and back
Chris@16 117 \ingroup transform
Chris@16 118 \tparam P1 first point type
Chris@16 119 \tparam P2 second point type
Chris@16 120 \tparam F additional functor to divide or multiply with d2r
Chris@16 121 */
Chris@16 122 template <typename P1, typename P2, template <typename> class F>
Chris@16 123 struct degree_radian_vv
Chris@16 124 {
Chris@16 125 inline bool apply(P1 const& p1, P2& p2) const
Chris@16 126 {
Chris@16 127 // Spherical coordinates always have 2 coordinates measured in angles
Chris@16 128 // The optional third one is distance/height, provided in another strategy
Chris@16 129 // Polar coordinates having one angle, will be also in another strategy
Chris@16 130 assert_dimension<P1, 2>();
Chris@16 131 assert_dimension<P2, 2>();
Chris@16 132
Chris@16 133 detail::transform_coordinates<P1, P2, 0, 2, F>::transform(p1, p2, math::d2r);
Chris@16 134 return true;
Chris@16 135 }
Chris@16 136 };
Chris@16 137
Chris@16 138 template <typename P1, typename P2, template <typename> class F>
Chris@16 139 struct degree_radian_vv_3
Chris@16 140 {
Chris@16 141 inline bool apply(P1 const& p1, P2& p2) const
Chris@16 142 {
Chris@16 143 assert_dimension<P1, 3>();
Chris@16 144 assert_dimension<P2, 3>();
Chris@16 145
Chris@16 146 detail::transform_coordinates<P1, P2, 0, 2, F>::transform(p1, p2, math::d2r);
Chris@16 147 // Copy height or other third dimension
Chris@16 148 set<2>(p2, get<2>(p1));
Chris@16 149 return true;
Chris@16 150 }
Chris@16 151 };
Chris@16 152
Chris@16 153
Chris@16 154 #ifndef DOXYGEN_NO_DETAIL
Chris@16 155 namespace detail
Chris@16 156 {
Chris@16 157
Chris@16 158 /// Helper function for conversion, phi/theta are in radians
Chris@16 159 template <typename P, typename T, typename R>
Chris@16 160 inline void spherical_polar_to_cartesian(T phi, T theta, R r, P& p)
Chris@16 161 {
Chris@16 162 assert_dimension<P, 3>();
Chris@16 163
Chris@16 164 // http://en.wikipedia.org/wiki/List_of_canonical_coordinate_transformations#From_spherical_coordinates
Chris@16 165 // http://www.vias.org/comp_geometry/math_coord_convert_3d.htm
Chris@16 166 // https://moodle.polymtl.ca/file.php/1183/Autres_Documents/Derivation_for_Spherical_Co-ordinates.pdf
Chris@16 167 // http://en.citizendium.org/wiki/Spherical_polar_coordinates
Chris@101 168
Chris@16 169 // Phi = first, theta is second, r is third, see documentation on cs::spherical
Chris@16 170
Chris@16 171 // (calculations are splitted to implement ttmath)
Chris@16 172
Chris@16 173 T r_sin_theta = r;
Chris@16 174 T r_cos_theta = r;
Chris@16 175 r_sin_theta *= sin(theta);
Chris@16 176 r_cos_theta *= cos(theta);
Chris@16 177
Chris@16 178 set<0>(p, r_sin_theta * cos(phi));
Chris@16 179 set<1>(p, r_sin_theta * sin(phi));
Chris@16 180 set<2>(p, r_cos_theta);
Chris@16 181 }
Chris@101 182
Chris@16 183 /// Helper function for conversion, lambda/delta (lon lat) are in radians
Chris@16 184 template <typename P, typename T, typename R>
Chris@16 185 inline void spherical_equatorial_to_cartesian(T lambda, T delta, R r, P& p)
Chris@16 186 {
Chris@16 187 assert_dimension<P, 3>();
Chris@16 188
Chris@16 189 // http://mathworld.wolfram.com/GreatCircle.html
Chris@16 190 // http://www.spenvis.oma.be/help/background/coortran/coortran.html WRONG
Chris@101 191
Chris@16 192 T r_cos_delta = r;
Chris@16 193 T r_sin_delta = r;
Chris@16 194 r_cos_delta *= cos(delta);
Chris@16 195 r_sin_delta *= sin(delta);
Chris@16 196
Chris@16 197 set<0>(p, r_cos_delta * cos(lambda));
Chris@16 198 set<1>(p, r_cos_delta * sin(lambda));
Chris@16 199 set<2>(p, r_sin_delta);
Chris@16 200 }
Chris@101 201
Chris@16 202
Chris@16 203 /// Helper function for conversion
Chris@16 204 template <typename P, typename T>
Chris@16 205 inline bool cartesian_to_spherical2(T x, T y, T z, P& p)
Chris@16 206 {
Chris@16 207 assert_dimension<P, 2>();
Chris@16 208
Chris@16 209 // http://en.wikipedia.org/wiki/List_of_canonical_coordinate_transformations#From_Cartesian_coordinates
Chris@16 210
Chris@16 211 #if defined(BOOST_GEOMETRY_TRANSFORM_CHECK_UNIT_SPHERE)
Chris@16 212 // TODO: MAYBE ONLY IF TO BE CHECKED?
Chris@16 213 T const r = /*sqrt not necessary, sqrt(1)=1*/ (x * x + y * y + z * z);
Chris@16 214
Chris@16 215 // Unit sphere, so r should be 1
Chris@16 216 if (geometry::math::abs(r - 1.0) > T(1e-6))
Chris@16 217 {
Chris@16 218 return false;
Chris@16 219 }
Chris@16 220 // end todo
Chris@16 221 #endif
Chris@16 222
Chris@16 223 set_from_radian<0>(p, atan2(y, x));
Chris@16 224 set_from_radian<1>(p, acos(z));
Chris@16 225 return true;
Chris@16 226 }
Chris@101 227
Chris@16 228 template <typename P, typename T>
Chris@16 229 inline bool cartesian_to_spherical_equatorial2(T x, T y, T z, P& p)
Chris@16 230 {
Chris@16 231 assert_dimension<P, 2>();
Chris@16 232
Chris@16 233 set_from_radian<0>(p, atan2(y, x));
Chris@16 234 set_from_radian<1>(p, asin(z));
Chris@16 235 return true;
Chris@16 236 }
Chris@101 237
Chris@16 238
Chris@16 239 template <typename P, typename T>
Chris@16 240 inline bool cartesian_to_spherical3(T x, T y, T z, P& p)
Chris@16 241 {
Chris@16 242 assert_dimension<P, 3>();
Chris@16 243
Chris@16 244 // http://en.wikipedia.org/wiki/List_of_canonical_coordinate_transformations#From_Cartesian_coordinates
Chris@101 245 T const r = math::sqrt(x * x + y * y + z * z);
Chris@16 246 set<2>(p, r);
Chris@16 247 set_from_radian<0>(p, atan2(y, x));
Chris@16 248 if (r > 0.0)
Chris@16 249 {
Chris@16 250 set_from_radian<1>(p, acos(z / r));
Chris@16 251 return true;
Chris@16 252 }
Chris@16 253 return false;
Chris@16 254 }
Chris@16 255
Chris@16 256 template <typename P, typename T>
Chris@16 257 inline bool cartesian_to_spherical_equatorial3(T x, T y, T z, P& p)
Chris@16 258 {
Chris@16 259 assert_dimension<P, 3>();
Chris@16 260
Chris@16 261 // http://en.wikipedia.org/wiki/List_of_canonical_coordinate_transformations#From_Cartesian_coordinates
Chris@101 262 T const r = math::sqrt(x * x + y * y + z * z);
Chris@16 263 set<2>(p, r);
Chris@16 264 set_from_radian<0>(p, atan2(y, x));
Chris@16 265 if (r > 0.0)
Chris@16 266 {
Chris@16 267 set_from_radian<1>(p, asin(z / r));
Chris@16 268 return true;
Chris@16 269 }
Chris@16 270 return false;
Chris@16 271 }
Chris@16 272
Chris@16 273 } // namespace detail
Chris@16 274 #endif // DOXYGEN_NO_DETAIL
Chris@16 275
Chris@16 276
Chris@16 277 /*!
Chris@16 278 \brief Transformation strategy for 2D spherical (phi,theta) to 3D cartesian (x,y,z)
Chris@16 279 \details on Unit sphere
Chris@16 280 \ingroup transform
Chris@16 281 \tparam P1 first point type
Chris@16 282 \tparam P2 second point type
Chris@16 283 */
Chris@16 284 template <typename P1, typename P2>
Chris@16 285 struct from_spherical_polar_2_to_cartesian_3
Chris@16 286 {
Chris@16 287 inline bool apply(P1 const& p1, P2& p2) const
Chris@16 288 {
Chris@16 289 assert_dimension<P1, 2>();
Chris@16 290 detail::spherical_polar_to_cartesian(get_as_radian<0>(p1), get_as_radian<1>(p1), 1.0, p2);
Chris@16 291 return true;
Chris@16 292 }
Chris@16 293 };
Chris@16 294
Chris@16 295 template <typename P1, typename P2>
Chris@16 296 struct from_spherical_equatorial_2_to_cartesian_3
Chris@16 297 {
Chris@16 298 inline bool apply(P1 const& p1, P2& p2) const
Chris@16 299 {
Chris@16 300 assert_dimension<P1, 2>();
Chris@16 301 detail::spherical_equatorial_to_cartesian(get_as_radian<0>(p1), get_as_radian<1>(p1), 1.0, p2);
Chris@16 302 return true;
Chris@16 303 }
Chris@16 304 };
Chris@16 305
Chris@16 306
Chris@16 307 /*!
Chris@16 308 \brief Transformation strategy for 3D spherical (phi,theta,r) to 3D cartesian (x,y,z)
Chris@16 309 \ingroup transform
Chris@16 310 \tparam P1 first point type
Chris@16 311 \tparam P2 second point type
Chris@16 312 */
Chris@16 313 template <typename P1, typename P2>
Chris@16 314 struct from_spherical_polar_3_to_cartesian_3
Chris@16 315 {
Chris@16 316 inline bool apply(P1 const& p1, P2& p2) const
Chris@16 317 {
Chris@16 318 assert_dimension<P1, 3>();
Chris@16 319 detail::spherical_polar_to_cartesian(
Chris@16 320 get_as_radian<0>(p1), get_as_radian<1>(p1), get<2>(p1), p2);
Chris@16 321 return true;
Chris@16 322 }
Chris@16 323 };
Chris@16 324
Chris@16 325 template <typename P1, typename P2>
Chris@16 326 struct from_spherical_equatorial_3_to_cartesian_3
Chris@16 327 {
Chris@16 328 inline bool apply(P1 const& p1, P2& p2) const
Chris@16 329 {
Chris@16 330 assert_dimension<P1, 3>();
Chris@16 331 detail::spherical_equatorial_to_cartesian(
Chris@16 332 get_as_radian<0>(p1), get_as_radian<1>(p1), get<2>(p1), p2);
Chris@16 333 return true;
Chris@16 334 }
Chris@16 335 };
Chris@16 336
Chris@16 337
Chris@16 338 /*!
Chris@16 339 \brief Transformation strategy for 3D cartesian (x,y,z) to 2D spherical (phi,theta)
Chris@16 340 \details on Unit sphere
Chris@16 341 \ingroup transform
Chris@16 342 \tparam P1 first point type
Chris@16 343 \tparam P2 second point type
Chris@16 344 \note If x,y,z point is not lying on unit sphere, transformation will return false
Chris@16 345 */
Chris@16 346 template <typename P1, typename P2>
Chris@16 347 struct from_cartesian_3_to_spherical_polar_2
Chris@16 348 {
Chris@16 349 inline bool apply(P1 const& p1, P2& p2) const
Chris@16 350 {
Chris@16 351 assert_dimension<P1, 3>();
Chris@16 352 return detail::cartesian_to_spherical2(get<0>(p1), get<1>(p1), get<2>(p1), p2);
Chris@16 353 }
Chris@16 354 };
Chris@16 355
Chris@16 356 template <typename P1, typename P2>
Chris@16 357 struct from_cartesian_3_to_spherical_equatorial_2
Chris@16 358 {
Chris@16 359 inline bool apply(P1 const& p1, P2& p2) const
Chris@16 360 {
Chris@16 361 assert_dimension<P1, 3>();
Chris@16 362 return detail::cartesian_to_spherical_equatorial2(get<0>(p1), get<1>(p1), get<2>(p1), p2);
Chris@16 363 }
Chris@16 364 };
Chris@16 365
Chris@16 366
Chris@16 367 /*!
Chris@16 368 \brief Transformation strategy for 3D cartesian (x,y,z) to 3D spherical (phi,theta,r)
Chris@16 369 \ingroup transform
Chris@16 370 \tparam P1 first point type
Chris@16 371 \tparam P2 second point type
Chris@16 372 */
Chris@16 373 template <typename P1, typename P2>
Chris@16 374 struct from_cartesian_3_to_spherical_polar_3
Chris@16 375 {
Chris@16 376 inline bool apply(P1 const& p1, P2& p2) const
Chris@16 377 {
Chris@16 378 assert_dimension<P1, 3>();
Chris@16 379 return detail::cartesian_to_spherical3(get<0>(p1), get<1>(p1), get<2>(p1), p2);
Chris@16 380 }
Chris@16 381 };
Chris@16 382
Chris@16 383 template <typename P1, typename P2>
Chris@16 384 struct from_cartesian_3_to_spherical_equatorial_3
Chris@16 385 {
Chris@16 386 inline bool apply(P1 const& p1, P2& p2) const
Chris@16 387 {
Chris@16 388 assert_dimension<P1, 3>();
Chris@16 389 return detail::cartesian_to_spherical_equatorial3(get<0>(p1), get<1>(p1), get<2>(p1), p2);
Chris@16 390 }
Chris@16 391 };
Chris@16 392
Chris@16 393 #ifndef DOXYGEN_NO_STRATEGY_SPECIALIZATIONS
Chris@16 394
Chris@16 395 namespace services
Chris@16 396 {
Chris@16 397
Chris@16 398 /// Specialization for same coordinate system family, same system, same dimension, same point type, can be copied
Chris@16 399 template <typename CoordSysTag, typename CoordSys, std::size_t D, typename P>
Chris@16 400 struct default_strategy<CoordSysTag, CoordSysTag, CoordSys, CoordSys, D, D, P, P>
Chris@16 401 {
Chris@16 402 typedef copy_direct<P> type;
Chris@16 403 };
Chris@16 404
Chris@16 405 /// Specialization for same coordinate system family and system, same dimension, different point type, copy per coordinate
Chris@16 406 template <typename CoordSysTag, typename CoordSys, std::size_t D, typename P1, typename P2>
Chris@16 407 struct default_strategy<CoordSysTag, CoordSysTag, CoordSys, CoordSys, D, D, P1, P2>
Chris@16 408 {
Chris@16 409 typedef copy_per_coordinate<P1, P2> type;
Chris@16 410 };
Chris@16 411
Chris@16 412 /// Specialization to transform from degree to radian for any coordinate system / point type combination
Chris@16 413 template <typename CoordSysTag, template<typename> class CoordSys, typename P1, typename P2>
Chris@16 414 struct default_strategy<CoordSysTag, CoordSysTag, CoordSys<degree>, CoordSys<radian>, 2, 2, P1, P2>
Chris@16 415 {
Chris@16 416 typedef degree_radian_vv<P1, P2, std::multiplies> type;
Chris@16 417 };
Chris@16 418
Chris@16 419 /// Specialization to transform from radian to degree for any coordinate system / point type combination
Chris@16 420 template <typename CoordSysTag, template<typename> class CoordSys, typename P1, typename P2>
Chris@16 421 struct default_strategy<CoordSysTag, CoordSysTag, CoordSys<radian>, CoordSys<degree>, 2, 2, P1, P2>
Chris@16 422 {
Chris@16 423 typedef degree_radian_vv<P1, P2, std::divides> type;
Chris@16 424 };
Chris@16 425
Chris@16 426
Chris@16 427 /// Specialization degree->radian in 3D
Chris@16 428 template <typename CoordSysTag, template<typename> class CoordSys, typename P1, typename P2>
Chris@16 429 struct default_strategy<CoordSysTag, CoordSysTag, CoordSys<degree>, CoordSys<radian>, 3, 3, P1, P2>
Chris@16 430 {
Chris@16 431 typedef degree_radian_vv_3<P1, P2, std::multiplies> type;
Chris@16 432 };
Chris@16 433
Chris@16 434 /// Specialization radian->degree in 3D
Chris@16 435 template <typename CoordSysTag, template<typename> class CoordSys, typename P1, typename P2>
Chris@16 436 struct default_strategy<CoordSysTag, CoordSysTag, CoordSys<radian>, CoordSys<degree>, 3, 3, P1, P2>
Chris@16 437 {
Chris@16 438 typedef degree_radian_vv_3<P1, P2, std::divides> type;
Chris@16 439 };
Chris@16 440
Chris@16 441 /// Specialization to transform from unit sphere(phi,theta) to XYZ
Chris@16 442 template <typename CoordSys1, typename CoordSys2, typename P1, typename P2>
Chris@16 443 struct default_strategy<spherical_polar_tag, cartesian_tag, CoordSys1, CoordSys2, 2, 3, P1, P2>
Chris@16 444 {
Chris@16 445 typedef from_spherical_polar_2_to_cartesian_3<P1, P2> type;
Chris@16 446 };
Chris@16 447
Chris@16 448 /// Specialization to transform from sphere(phi,theta,r) to XYZ
Chris@16 449 template <typename CoordSys1, typename CoordSys2, typename P1, typename P2>
Chris@16 450 struct default_strategy<spherical_polar_tag, cartesian_tag, CoordSys1, CoordSys2, 3, 3, P1, P2>
Chris@16 451 {
Chris@16 452 typedef from_spherical_polar_3_to_cartesian_3<P1, P2> type;
Chris@16 453 };
Chris@16 454
Chris@16 455 template <typename CoordSys1, typename CoordSys2, typename P1, typename P2>
Chris@16 456 struct default_strategy<spherical_equatorial_tag, cartesian_tag, CoordSys1, CoordSys2, 2, 3, P1, P2>
Chris@16 457 {
Chris@16 458 typedef from_spherical_equatorial_2_to_cartesian_3<P1, P2> type;
Chris@16 459 };
Chris@16 460
Chris@16 461 template <typename CoordSys1, typename CoordSys2, typename P1, typename P2>
Chris@16 462 struct default_strategy<spherical_equatorial_tag, cartesian_tag, CoordSys1, CoordSys2, 3, 3, P1, P2>
Chris@16 463 {
Chris@16 464 typedef from_spherical_equatorial_3_to_cartesian_3<P1, P2> type;
Chris@16 465 };
Chris@16 466
Chris@16 467 /// Specialization to transform from XYZ to unit sphere(phi,theta)
Chris@16 468 template <typename CoordSys1, typename CoordSys2, typename P1, typename P2>
Chris@16 469 struct default_strategy<cartesian_tag, spherical_polar_tag, CoordSys1, CoordSys2, 3, 2, P1, P2>
Chris@16 470 {
Chris@16 471 typedef from_cartesian_3_to_spherical_polar_2<P1, P2> type;
Chris@16 472 };
Chris@16 473
Chris@16 474 template <typename CoordSys1, typename CoordSys2, typename P1, typename P2>
Chris@16 475 struct default_strategy<cartesian_tag, spherical_equatorial_tag, CoordSys1, CoordSys2, 3, 2, P1, P2>
Chris@16 476 {
Chris@16 477 typedef from_cartesian_3_to_spherical_equatorial_2<P1, P2> type;
Chris@16 478 };
Chris@16 479
Chris@16 480 /// Specialization to transform from XYZ to sphere(phi,theta,r)
Chris@16 481 template <typename CoordSys1, typename CoordSys2, typename P1, typename P2>
Chris@16 482 struct default_strategy<cartesian_tag, spherical_polar_tag, CoordSys1, CoordSys2, 3, 3, P1, P2>
Chris@16 483 {
Chris@16 484 typedef from_cartesian_3_to_spherical_polar_3<P1, P2> type;
Chris@16 485 };
Chris@16 486 template <typename CoordSys1, typename CoordSys2, typename P1, typename P2>
Chris@16 487 struct default_strategy<cartesian_tag, spherical_equatorial_tag, CoordSys1, CoordSys2, 3, 3, P1, P2>
Chris@16 488 {
Chris@16 489 typedef from_cartesian_3_to_spherical_equatorial_3<P1, P2> type;
Chris@16 490 };
Chris@16 491
Chris@16 492
Chris@16 493 } // namespace services
Chris@16 494
Chris@16 495
Chris@16 496 #endif // DOXYGEN_NO_STRATEGY_SPECIALIZATIONS
Chris@16 497
Chris@16 498
Chris@16 499 }} // namespace strategy::transform
Chris@16 500
Chris@16 501
Chris@16 502 }} // namespace boost::geometry
Chris@16 503
Chris@16 504 #endif // BOOST_GEOMETRY_STRATEGIES_STRATEGY_TRANSFORM_HPP