Chris@16
|
1 // Boost.Polygon library segment_traits.hpp header file
|
Chris@16
|
2
|
Chris@16
|
3 // Copyright (c) Intel Corporation 2008.
|
Chris@16
|
4 // Copyright (c) 2008-2012 Simonson Lucanus.
|
Chris@16
|
5 // Copyright (c) 2012-2012 Andrii Sydorchuk.
|
Chris@16
|
6
|
Chris@16
|
7 // See http://www.boost.org for updates, documentation, and revision history.
|
Chris@16
|
8 // Use, modification and distribution is subject to the Boost Software License,
|
Chris@16
|
9 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
Chris@16
|
10 // http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
11
|
Chris@16
|
12 #ifndef BOOST_POLYGON_SEGMENT_TRAITS_HPP
|
Chris@16
|
13 #define BOOST_POLYGON_SEGMENT_TRAITS_HPP
|
Chris@16
|
14
|
Chris@16
|
15 #include "isotropy.hpp"
|
Chris@16
|
16
|
Chris@16
|
17 namespace boost {
|
Chris@16
|
18 namespace polygon {
|
Chris@16
|
19
|
Chris@16
|
20 template <typename Segment>
|
Chris@16
|
21 struct segment_traits {
|
Chris@16
|
22 typedef Segment segment_type;
|
Chris@16
|
23 typedef typename segment_type::point_type point_type;
|
Chris@16
|
24 typedef typename segment_type::coordinate_type coordinate_type;
|
Chris@16
|
25
|
Chris@16
|
26 static point_type get(
|
Chris@16
|
27 const segment_type& segment, direction_1d dir) {
|
Chris@16
|
28 return segment.get(dir);
|
Chris@16
|
29 }
|
Chris@16
|
30 };
|
Chris@16
|
31
|
Chris@16
|
32 template <typename Segment>
|
Chris@16
|
33 struct segment_mutable_traits {
|
Chris@16
|
34 typedef Segment segment_type;
|
Chris@16
|
35 typedef typename segment_type::point_type point_type;
|
Chris@16
|
36 typedef typename segment_type::coordinate_type coordinate_type;
|
Chris@16
|
37
|
Chris@16
|
38 static void set(
|
Chris@16
|
39 segment_type& segment, direction_1d dir, const point_type& point) {
|
Chris@16
|
40 segment.set(dir, point);
|
Chris@16
|
41 }
|
Chris@16
|
42
|
Chris@16
|
43 static segment_type construct(const point_type& low, const point_type& high) {
|
Chris@16
|
44 return segment_type(low, high);
|
Chris@16
|
45 }
|
Chris@16
|
46 };
|
Chris@16
|
47 } // polygon
|
Chris@16
|
48 } // boost
|
Chris@16
|
49
|
Chris@16
|
50 #endif // BOOST_POLYGON_SEGMENT_TRAITS_HPP
|