segment_traits.hpp 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. // Boost.Polygon library segment_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_SEGMENT_TRAITS_HPP
  10. #define BOOST_POLYGON_SEGMENT_TRAITS_HPP
  11. #include "isotropy.hpp"
  12. namespace boost {
  13. namespace polygon {
  14. template <typename Segment>
  15. struct segment_traits {
  16. typedef Segment segment_type;
  17. typedef typename segment_type::point_type point_type;
  18. typedef typename segment_type::coordinate_type coordinate_type;
  19. static point_type get(
  20. const segment_type& segment, direction_1d dir) {
  21. return segment.get(dir);
  22. }
  23. };
  24. template <typename Segment>
  25. struct segment_mutable_traits {
  26. typedef Segment segment_type;
  27. typedef typename segment_type::point_type point_type;
  28. typedef typename segment_type::coordinate_type coordinate_type;
  29. static void set(
  30. segment_type& segment, direction_1d dir, const point_type& point) {
  31. segment.set(dir, point);
  32. }
  33. static segment_type construct(const point_type& low, const point_type& high) {
  34. return segment_type(low, high);
  35. }
  36. };
  37. } // polygon
  38. } // boost
  39. #endif // BOOST_POLYGON_SEGMENT_TRAITS_HPP