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

source code of boost/boost/polygon/segment_traits.hpp