1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
use ;
use BooleanOps;
use BoundingRect;
/// Represents a rectangular envelope defined by its minimum and maximum coordinates.
///
/// # Examples
///
/// ```
/// use arcgis_rust::core::geometry::{Envelope};
/// use geo::point;
///
/// let envelope = Envelope {
/// min: point!(x: 0.0, y: 0.0),
/// max: point!(x: 10.0, y: 10.0),
/// };
/// let point_inside = point!(x: 5.0, y: 5.0);
/// let point_outside = point!(x: 15.0, y: 15.0);
///
/// assert!(envelope.contains(&point_inside));
/// assert!(!envelope.contains(&point_outside));
/// ```
/// Calculates the intersection of two polygons.
///
/// # Arguments
///
/// * `poly1` - A reference to the first `Polygon`.
/// * `poly2` - A reference to the second `Polygon`.
///
/// # Returns
///
/// * A `Polygon` representing the intersection of the two input polygons.
///
/// # Examples
///
/// ```
/// use geo::polygon;
/// use arcgis_rust::core::geometry::intersection;
///
/// let poly1 = polygon![
/// (x: 0.0, y: 0.0),
/// (x: 10.0, y: 0.0),
/// (x: 10.0, y: 10.0),
/// (x: 0.0, y: 10.0),
/// (x: 0.0, y: 0.0),
/// ];
///
/// let poly2 = polygon![
/// (x: 5.0, y: 5.0),
/// (x: 15.0, y: 5.0),
/// (x: 15.0, y: 15.0),
/// (x: 5.0, y: 15.0),
/// (x: 5.0, y: 5.0),
/// ];
///
/// let intersection_poly = intersection(&poly1, &poly2);
/// ```
/// Merges two polygons into a single polygon (union).
///
/// # Arguments
///
/// * `poly1` - A reference to the first `Polygon`.
/// * `poly2` - A reference to the second `Polygon`.
///
/// # Returns
///
/// * A `Polygon` representing the union of the two input polygons.
///
/// # Examples
///
/// ```
/// use geo::polygon;
/// use arcgis_rust::core::geometry::union;
///
/// let poly1 = polygon![
/// (x: 0.0, y: 0.0),
/// (x: 10.0, y: 0.0),
/// (x: 10.0, y: 10.0),
/// (x: 0.0, y: 10.0),
/// (x: 0.0, y: 0.0),
/// ];
///
/// let poly2 = polygon![
/// (x: 5.0, y: 5.0),
/// (x: 15.0, y: 5.0),
/// (x: 15.0, y: 15.0),
/// (x: 5.0, y: 15.0),
/// (x: 5.0, y: 5.0),
/// ];
///
/// let union_poly = union(&poly1, &poly2);
/// ```
/// Creates a bounding box as a simple buffer zone around a line.
///
/// # Arguments
///
/// * `line` - A reference to the `LineString` around which to create the buffer.
/// * `distance` - The buffer distance.
///
/// # Returns
///
/// * A `Polygon` representing the buffer zone around the input line.
///
/// # Examples
///
/// ```
/// use geo::LineString;
/// use arcgis_rust::core::geometry::buffer;
///
/// let line = LineString::from(vec![
/// (0.0, 0.0),
/// (10.0, 0.0),
/// ]);
///
/// let buffer_distance = 1.0;
/// let buffer_poly = buffer(&line, buffer_distance);
/// ```