1 // Boost.Geometry (aka GGL, Generic Geometry Library) 2 3 // Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands. 4 5 // This file was modified by Oracle on 2015, 2016. 6 // Modifications copyright (c) 2015-2016 Oracle and/or its affiliates. 7 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle 8 9 // Use, modification and distribution is subject to the Boost Software License, 10 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 11 // http://www.boost.org/LICENSE_1_0.txt) 12 13 #ifndef BOOST_GEOMETRY_STRATEGIES_INTERSECTION_RESULT_HPP 14 #define BOOST_GEOMETRY_STRATEGIES_INTERSECTION_RESULT_HPP 15 16 #include <cstddef> 17 18 #include <boost/geometry/policies/robustness/segment_ratio.hpp> 19 20 21 namespace boost { namespace geometry 22 { 23 24 template <typename SegmentRatio> 25 struct fraction_type 26 { 27 SegmentRatio robust_ra; // TODO this can be renamed now to "ra" 28 SegmentRatio robust_rb; 29 30 bool initialized; fraction_typeboost::geometry::fraction_type31 inline fraction_type() 32 : initialized(false) 33 {} 34 35 template <typename Info> assignboost::geometry::fraction_type36 inline void assign(Info const& info) 37 { 38 initialized = true; 39 robust_ra = info.robust_ra; 40 robust_rb = info.robust_rb; 41 } 42 assignboost::geometry::fraction_type43 inline void assign(SegmentRatio const& a, SegmentRatio const& b) 44 { 45 initialized = true; 46 robust_ra = a; 47 robust_rb = b; 48 } 49 50 }; 51 52 // 53 /*! 54 \brief return-type for segment-intersection 55 \note Set in intersection_points.hpp, from segment_intersection_info 56 */ 57 template 58 < 59 typename Point, 60 typename SegmentRatio = segment_ratio<typename coordinate_type<Point>::type> 61 > 62 struct segment_intersection_points 63 { 64 std::size_t count; // The number of intersection points 65 66 // TODO: combine intersections and fractions in one struct 67 Point intersections[2]; 68 fraction_type<SegmentRatio> fractions[2]; 69 typedef Point point_type; 70 segment_intersection_pointsboost::geometry::segment_intersection_points71 segment_intersection_points() 72 : count(0) 73 {} 74 }; 75 76 }} // namespace boost::geometry 77 78 79 #endif // BOOST_GEOMETRY_STRATEGIES_INTERSECTION_RESULT_HPP 80