1 // Boost.Geometry (aka GGL, Generic Geometry Library)
3 // Copyright (c) 2007-2012 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_GEOMETRY_POLICIES_RELATE_TUPLED_HPP
10 #define BOOST_GEOMETRY_GEOMETRY_POLICIES_RELATE_TUPLED_HPP
15 #include <boost/tuple/tuple.hpp>
16 #include <boost/geometry/strategies/side_info.hpp>
18 namespace boost { namespace geometry
21 namespace policies { namespace relate
25 // "tupled" to return intersection results together.
26 // Now with two, with some meta-programming and derivations it can also be three (or more)
27 template <typename Policy1, typename Policy2>
28 struct segments_tupled
32 typename Policy1::return_type,
33 typename Policy2::return_type
36 template <typename Segment1, typename Segment2, typename SegmentIntersectionInfo>
37 static inline return_type segments_crosses(side_info const& sides,
38 SegmentIntersectionInfo const& sinfo,
39 Segment1 const& s1, Segment2 const& s2)
41 return boost::make_tuple
43 Policy1::segments_crosses(sides, sinfo, s1, s2),
44 Policy2::segments_crosses(sides, sinfo, s1, s2)
48 template <typename Segment1, typename Segment2, typename Ratio>
49 static inline return_type segments_collinear(
50 Segment1 const& segment1, Segment2 const& segment2,
52 int pa1, int pa2, int pb1, int pb2,
53 Ratio const& ra1, Ratio const& ra2,
54 Ratio const& rb1, Ratio const& rb2)
56 return boost::make_tuple
58 Policy1::segments_collinear(segment1, segment2,
62 Policy2::segments_collinear(segment1, segment2,
69 template <typename Segment>
70 static inline return_type degenerate(Segment const& segment,
73 return boost::make_tuple
75 Policy1::degenerate(segment, a_degenerate),
76 Policy2::degenerate(segment, a_degenerate)
80 template <typename Segment, typename Ratio>
81 static inline return_type one_degenerate(Segment const& segment,
85 return boost::make_tuple
87 Policy1::one_degenerate(segment, ratio, a_degenerate),
88 Policy2::one_degenerate(segment, ratio, a_degenerate)
92 static inline return_type disjoint()
94 return boost::make_tuple
101 static inline return_type error(std::string const& msg)
103 return boost::make_tuple
112 }} // namespace policies::relate
114 }} // namespace boost::geometry
116 #endif // BOOST_GEOMETRY_GEOMETRY_POLICIES_RELATE_TUPLED_HPP