inverse_transformer.hpp 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. // Boost.Geometry (aka GGL, Generic Geometry Library)
  2. // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
  3. // Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
  4. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
  5. // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
  6. // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
  7. // Use, modification and distribution is subject to the Boost Software License,
  8. // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  9. // http://www.boost.org/LICENSE_1_0.txt)
  10. #ifndef BOOST_GEOMETRY_STRATEGIES_TRANSFORM_INVERSE_TRANSFORMER_HPP
  11. #define BOOST_GEOMETRY_STRATEGIES_TRANSFORM_INVERSE_TRANSFORMER_HPP
  12. #include <boost/qvm/mat.hpp>
  13. #include <boost/qvm/mat_operations.hpp>
  14. #include <boost/geometry/strategies/transform/matrix_transformers.hpp>
  15. namespace boost { namespace geometry
  16. {
  17. namespace strategy { namespace transform
  18. {
  19. /*!
  20. \brief Transformation strategy to do an inverse transformation in a Cartesian coordinate system
  21. \ingroup strategies
  22. */
  23. template
  24. <
  25. typename CalculationType,
  26. std::size_t Dimension1,
  27. std::size_t Dimension2
  28. >
  29. class inverse_transformer
  30. : public matrix_transformer<CalculationType, Dimension1, Dimension2>
  31. {
  32. public :
  33. template <typename Transformer>
  34. inline inverse_transformer(Transformer const& input)
  35. {
  36. this->m_matrix = boost::qvm::inverse(input.matrix());
  37. }
  38. };
  39. }} // namespace strategy::transform
  40. }} // namespace boost::geometry
  41. #endif // BOOST_GEOMETRY_STRATEGIES_TRANSFORM_INVERSE_TRANSFORMER_HPP