point_traits.hpp 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. // Boost.Polygon library point_traits.hpp header file
  2. // Copyright (c) Intel Corporation 2008.
  3. // Copyright (c) 2008-2012 Simonson Lucanus.
  4. // Copyright (c) 2012-2012 Andrii Sydorchuk.
  5. // See http://www.boost.org for updates, documentation, and revision history.
  6. // Use, modification and distribution is subject to the Boost Software License,
  7. // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  8. // http://www.boost.org/LICENSE_1_0.txt)
  9. #ifndef BOOST_POLYGON_POINT_TRAITS_HPP
  10. #define BOOST_POLYGON_POINT_TRAITS_HPP
  11. #include "isotropy.hpp"
  12. namespace boost {
  13. namespace polygon {
  14. template <typename PointType>
  15. struct point_traits {
  16. typedef PointType point_type;
  17. typedef typename point_type::coordinate_type coordinate_type;
  18. static coordinate_type get(
  19. const point_type& point, orientation_2d orient) {
  20. return point.get(orient);
  21. }
  22. };
  23. template <typename PointType>
  24. struct point_mutable_traits {
  25. typedef PointType point_type;
  26. typedef typename point_type::coordinate_type coordinate_type;
  27. static void set(
  28. point_type& point, orientation_2d orient, coordinate_type value) {
  29. point.set(orient, value);
  30. }
  31. static point_type construct(coordinate_type x, coordinate_type y) {
  32. return point_type(x, y);
  33. }
  34. };
  35. } // polygon
  36. } // boost
  37. #endif // BOOST_POLYGON_POINT_TRAITS_HPP