Chris@16
|
1 // Boost.Polygon library point_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_POINT_TRAITS_HPP
|
Chris@16
|
13 #define BOOST_POLYGON_POINT_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 PointType>
|
Chris@16
|
21 struct point_traits {
|
Chris@16
|
22 typedef PointType point_type;
|
Chris@16
|
23 typedef typename point_type::coordinate_type coordinate_type;
|
Chris@16
|
24
|
Chris@16
|
25 static coordinate_type get(
|
Chris@16
|
26 const point_type& point, orientation_2d orient) {
|
Chris@16
|
27 return point.get(orient);
|
Chris@16
|
28 }
|
Chris@16
|
29 };
|
Chris@16
|
30
|
Chris@16
|
31 template <typename PointType>
|
Chris@16
|
32 struct point_mutable_traits {
|
Chris@16
|
33 typedef PointType point_type;
|
Chris@16
|
34 typedef typename point_type::coordinate_type coordinate_type;
|
Chris@16
|
35
|
Chris@16
|
36 static void set(
|
Chris@16
|
37 point_type& point, orientation_2d orient, coordinate_type value) {
|
Chris@16
|
38 point.set(orient, value);
|
Chris@16
|
39 }
|
Chris@16
|
40
|
Chris@16
|
41 static point_type construct(coordinate_type x, coordinate_type y) {
|
Chris@16
|
42 return point_type(x, y);
|
Chris@16
|
43 }
|
Chris@16
|
44 };
|
Chris@16
|
45 } // polygon
|
Chris@16
|
46 } // boost
|
Chris@16
|
47
|
Chris@16
|
48 #endif // BOOST_POLYGON_POINT_TRAITS_HPP
|