@@ -151,6 +151,32 @@ static void drawClosedPunchExample()
151
151
drawTree (" drawings/closed_punched.png" , punched, false , false );
152
152
}
153
153
154
+ static void drawAdjacentClosedPunchExample ()
155
+ {
156
+ constexpr int iterations = 5 ;
157
+ using namespace lib_interval_tree ;
158
+
159
+ interval_tree<interval<int , closed_adjacent>> tree;
160
+
161
+ // insert shuffled into new tree
162
+ std::vector<std::pair<int , int >> intervals;
163
+ for (int i = 0 ; i < iterations; ++i)
164
+ {
165
+ intervals.emplace_back (i * 10 , i * 10 + 5 );
166
+ }
167
+
168
+ std::mt19937 rng (std::random_device{}());
169
+ std::shuffle (intervals.begin (), intervals.end (), rng);
170
+ for (const auto & interval : intervals)
171
+ {
172
+ tree.insert ({interval.first , interval.second });
173
+ }
174
+
175
+ drawTree (" drawings/closed_adjacent_punch_source.png" , tree, false , false );
176
+ const auto punched = tree.punch ({-10 , iterations * 10 + 10 });
177
+ drawTree (" drawings/closed_adjacent_punched.png" , punched, false , false );
178
+ }
179
+
154
180
static void drawFloatPunchExample ()
155
181
{
156
182
constexpr int iterations = 5 ;
@@ -184,5 +210,6 @@ static void drawAll()
184
210
drawLargeOverlapFree ();
185
211
drawOpenPunchExample ();
186
212
drawClosedPunchExample ();
213
+ drawAdjacentClosedPunchExample ();
187
214
drawFloatPunchExample ();
188
215
}
0 commit comments