intersection_result.hpp 1.9 KB

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