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