1 // Boost.Geometry (aka GGL, Generic Geometry Library)
3 // Copyright (c) 2019-2019 Barend Gehrels, Amsterdam, the Netherlands.
5 // Use, modification and distribution is subject to the Boost Software License,
6 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
7 // http://www.boost.org/LICENSE_1_0.txt)
9 #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_SEGMENT_AS_SUBRANGE_HPP
10 #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_SEGMENT_AS_SUBRANGE_HPP
16 #include <boost/geometry/core/access.hpp>
18 namespace boost { namespace geometry
21 #ifndef DOXYGEN_NO_DETAIL
25 template <typename Segment>
26 struct segment_as_subrange
28 segment_as_subrange(Segment const& s)
31 geometry::set<0>(m_p1, geometry::get<0, 0>(m_segment));
32 geometry::set<1>(m_p1, geometry::get<0, 1>(m_segment));
33 geometry::set<0>(m_p2, geometry::get<1, 0>(m_segment));
34 geometry::set<1>(m_p2, geometry::get<1, 1>(m_segment));
37 typedef typename geometry::point_type<Segment>::type point_type;
39 point_type const& at(std::size_t index) const
41 return index == 0 ? m_p1 : m_p2;
44 static inline bool is_last_segment()
49 point_type m_p1, m_p2;
51 Segment const& m_segment;
55 #endif // DOXYGEN_NO_DETAIL
57 }} // namespace boost::geometry
59 #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_SEGMENT_AS_SUBRANGE_HPP