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