Chris@16
|
1 // Boost.Polygon library interval_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_INTERVAL_TRAITS_HPP
|
Chris@16
|
13 #define BOOST_POLYGON_INTERVAL_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 Interval>
|
Chris@16
|
21 struct interval_traits {
|
Chris@16
|
22 typedef Interval interval_type;
|
Chris@16
|
23 typedef typename interval_type::coordinate_type coordinate_type;
|
Chris@16
|
24
|
Chris@16
|
25 static coordinate_type get(const interval_type& interval, direction_1d dir) {
|
Chris@16
|
26 return interval.get(dir);
|
Chris@16
|
27 }
|
Chris@16
|
28 };
|
Chris@16
|
29
|
Chris@16
|
30 template <typename Interval>
|
Chris@16
|
31 struct interval_mutable_traits {
|
Chris@16
|
32 typedef Interval interval_type;
|
Chris@16
|
33 typedef typename interval_type::coordinate_type coordinate_type;
|
Chris@16
|
34
|
Chris@16
|
35 static void set(
|
Chris@16
|
36 interval_type& interval, direction_1d dir, coordinate_type value) {
|
Chris@16
|
37 interval.set(dir, value);
|
Chris@16
|
38 }
|
Chris@16
|
39
|
Chris@16
|
40 static interval_type construct(coordinate_type low, coordinate_type high) {
|
Chris@16
|
41 return interval_type(low, high);
|
Chris@16
|
42 }
|
Chris@16
|
43 };
|
Chris@16
|
44 } // polygon
|
Chris@16
|
45 } // boost
|
Chris@16
|
46
|
Chris@16
|
47 #endif // BOOST_POLICY_INTERVAL_TRAITS_HPP
|