Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:35:36

0001 // Boost.Geometry (aka GGL, Generic Geometry Library)
0002 
0003 // Copyright (c) 2007-2020 Barend Gehrels, Amsterdam, the Netherlands.
0004 
0005 // This file was modified by Oracle on 2020.
0006 // Modifications copyright (c) 2020 Oracle and/or its affiliates.
0007 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
0008 
0009 // Use, modification and distribution is subject to the Boost Software License,
0010 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
0011 // http://www.boost.org/LICENSE_1_0.txt)
0012 
0013 #ifndef BOOST_GEOMETRY_GEOMETRY_POLICIES_RELATE_INTERSECTION_POLICY_HPP
0014 #define BOOST_GEOMETRY_GEOMETRY_POLICIES_RELATE_INTERSECTION_POLICY_HPP
0015 
0016 
0017 #include <string>
0018 #include <tuple>
0019 
0020 #include <boost/geometry/policies/relate/direction.hpp>
0021 #include <boost/geometry/policies/relate/intersection_points.hpp>
0022 
0023 #include <boost/geometry/strategies/side_info.hpp>
0024 
0025 namespace boost { namespace geometry
0026 {
0027 
0028 namespace policies { namespace relate
0029 {
0030 
0031 
0032 template <typename IntersectionPointsReturnType>
0033 struct segments_intersection_policy
0034 {
0035 private:
0036     typedef policies::relate::segments_intersection_points
0037         <
0038             IntersectionPointsReturnType
0039         > pts_policy;
0040     typedef policies::relate::segments_direction dir_policy;
0041 
0042 public:
0043     struct return_type
0044     {
0045         typedef typename pts_policy::return_type intersection_points_type;
0046         typedef typename dir_policy::return_type direction_type;
0047 
0048         return_type(intersection_points_type const& pts_result,
0049                     direction_type const& dir_result)
0050             : intersection_points(pts_result)
0051             , direction(dir_result)
0052         {}
0053 
0054         intersection_points_type intersection_points;
0055         direction_type direction;
0056     };
0057 
0058     template <typename Segment1, typename Segment2, typename SegmentIntersectionInfo>
0059     static inline return_type segments_crosses(side_info const& sides,
0060                                         SegmentIntersectionInfo const& sinfo,
0061                                         Segment1 const& s1, Segment2 const& s2)
0062     {
0063         return return_type
0064             (
0065                 pts_policy::segments_crosses(sides, sinfo, s1, s2),
0066                 dir_policy::segments_crosses(sides, sinfo, s1, s2)
0067             );
0068     }
0069 
0070     template <typename Segment1, typename Segment2, typename Ratio>
0071     static inline return_type segments_collinear(
0072                                         Segment1 const& segment1,
0073                                         Segment2 const& segment2,
0074                                         bool opposite,
0075                                         int pa1, int pa2, int pb1, int pb2,
0076                                         Ratio const& ra1, Ratio const& ra2,
0077                                         Ratio const& rb1, Ratio const& rb2)
0078     {
0079         return return_type
0080             (
0081                 pts_policy::segments_collinear(segment1, segment2,
0082                                                opposite,
0083                                                pa1, pa2, pb1, pb2,
0084                                                ra1, ra2, rb1, rb2),
0085                 dir_policy::segments_collinear(segment1, segment2,
0086                                                opposite,
0087                                                pa1, pa2, pb1, pb2,
0088                                                ra1, ra2, rb1, rb2)
0089             );
0090     }
0091 
0092     template <typename Segment>
0093     static inline return_type degenerate(Segment const& segment,
0094                                          bool a_degenerate)
0095     {
0096         return return_type
0097             (
0098                 pts_policy::degenerate(segment, a_degenerate),
0099                 dir_policy::degenerate(segment, a_degenerate)
0100             );
0101     }
0102 
0103     template <typename Segment, typename Ratio>
0104     static inline return_type one_degenerate(Segment const& segment,
0105                                              Ratio const& ratio,
0106                                              bool a_degenerate)
0107     {
0108         return return_type
0109             (
0110                 pts_policy::one_degenerate(segment, ratio, a_degenerate),
0111                 dir_policy::one_degenerate(segment, ratio, a_degenerate)
0112             );
0113     }
0114 
0115     static inline return_type disjoint()
0116     {
0117         return return_type
0118             (
0119                 pts_policy::disjoint(),
0120                 dir_policy::disjoint()
0121             );
0122     }
0123 
0124     static inline return_type error(std::string const& msg)
0125     {
0126         return return_type
0127             (
0128                 pts_policy::error(msg),
0129                 dir_policy::error(msg)
0130             );
0131     }
0132 };
0133 
0134 
0135 }} // namespace policies::relate
0136 
0137 }} // namespace boost::geometry
0138 
0139 #endif // BOOST_GEOMETRY_GEOMETRY_POLICIES_RELATE_INTERSECTION_POLICY_HPP