buffer.hpp 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. // Boost.Geometry (aka GGL, Generic Geometry Library)
  2. // Copyright (c) 2012-2014 Barend Gehrels, Amsterdam, the Netherlands.
  3. // Use, modification and distribution is subject to the Boost Software License,
  4. // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  5. // http://www.boost.org/LICENSE_1_0.txt)
  6. #ifndef BOOST_GEOMETRY_STRATEGIES_CARTESIAN_BUFFER_HPP
  7. #define BOOST_GEOMETRY_STRATEGIES_CARTESIAN_BUFFER_HPP
  8. namespace boost { namespace geometry
  9. {
  10. namespace strategy { namespace buffer
  11. {
  12. /*
  13. A Buffer-join strategy gets 4 input points.
  14. On the two consecutive segments s1 and s2 (joining at vertex v):
  15. The lines from parallel at s1, s2 (at buffer-distance) end/start
  16. in two points perpendicular to the segments: p1 and p2.
  17. These parallel lines interesct in point ip
  18. (s2)
  19. |
  20. |
  21. ^
  22. |
  23. (p2) |(v)
  24. * +----<--- (s1)
  25. x(ip) *(p1)
  26. So, in clockwise order:
  27. v : vertex point
  28. p1: perpendicular on left side of segment1<1> (perp1)
  29. ip: intersection point
  30. p2: perpendicular on left side of segment2<0> (perp2)
  31. */
  32. /*!
  33. \brief Enumerates options for side of buffer (left/right w.r.t. directed
  34. segment)
  35. \ingroup enum
  36. \details Around a linestring, a buffer can be defined left or right.
  37. Around a polygon, assumed clockwise internally,
  38. a buffer is either on the left side (inflates the polygon), or on the
  39. right side (deflates the polygon)
  40. */
  41. enum buffer_side_selector { buffer_side_left, buffer_side_right };
  42. /*!
  43. \brief Enumerates types of pieces (parts of buffer) around geometries
  44. \ingroup enum
  45. */
  46. enum piece_type
  47. {
  48. buffered_segment,
  49. buffered_join,
  50. buffered_round_end,
  51. buffered_flat_end,
  52. buffered_point,
  53. buffered_concave, // always on the inside
  54. piece_type_unknown
  55. };
  56. /*!
  57. \brief Enumerates types of joins
  58. \ingroup enum
  59. */
  60. enum join_selector
  61. {
  62. join_convex,
  63. join_concave,
  64. join_continue, // collinear, next segment touches previous segment
  65. join_spike // collinear, with overlap, next segment goes back
  66. };
  67. /*!
  68. \brief Enumerates types of result codes from buffer strategies
  69. \ingroup enum
  70. */
  71. enum result_code
  72. {
  73. result_normal,
  74. result_error_numerical,
  75. result_no_output
  76. };
  77. }} // namespace strategy::buffer
  78. }} // namespace boost::geometry
  79. #endif // BOOST_GEOMETRY_STRATEGIES_CARTESIAN_BUFFER_HPP