Aleph-w 7.10.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
tpl_2dtree.H
Go to the documentation of this file.
1/*
2 Aleph_w
3
4 Data structures & Algorithms
5 version 2.0.0b
6 https://github.com/lrleon/Aleph-w
7
8 This file is part of Aleph-w library
9
10 Copyright (c) 2002-2026 Leandro Rabindranath Leon
11
12 Permission is hereby granted, free of charge, to any person obtaining a copy
13 of this software and associated documentation files (the "Software"), to deal
14 in the Software without restriction, including without limitation the rights
15 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16 copies of the Software, and to permit persons to whom the Software is
17 furnished to do so, subject to the following conditions:
18
19 The above copyright notice and this permission notice shall be included in all
20 copies or substantial portions of the Software.
21
22 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28 SOFTWARE.
29*/
30
31
43# ifndef TPL_2DTREE_H
44# define TPL_2DTREE_H
45
46# include <point.H>
47# include <optional>
48# include <algorithm>
49# include <htlist.H>
50# include <ahSort.H>
51# include <tpl_array.H>
52# include <ahDefs.H> // For Empty_Class
53# include <utility>
54
56
134template <typename T = Empty_Class>
136{
138 struct Node
139 {
144
146 Node(Point p) noexcept
147 : point_(std::move(p)), lb_(nullptr), rt_(nullptr)
148 {
149 // empty
150 }
151
153 void set_rect(const Geom_Number & xmin, const Geom_Number & ymin,
154 const Geom_Number & xmax, const Geom_Number & ymax) noexcept
155 {
157 }
158
160 void set_rect(const Point & pmin, const Point & pmax) noexcept
161 {
162 rect_.set_rect(pmin.get_x(), pmin.get_y(), pmax.get_x(), pmax.get_y());
163 }
164
165 [[nodiscard]] const Geom_Number &xmin() const noexcept { return rect_.get_xmin(); }
166 [[nodiscard]] const Geom_Number &ymin() const noexcept { return rect_.get_ymin(); }
167 [[nodiscard]] const Geom_Number &xmax() const noexcept { return rect_.get_xmax(); }
168 [[nodiscard]] const Geom_Number &ymax() const noexcept { return rect_.get_ymax(); }
169 [[nodiscard]] const Geom_Number &x() const noexcept { return point_.get_x(); }
170 [[nodiscard]] const Geom_Number &y() const noexcept { return point_.get_y(); }
171 };
172
175 size_t N_;
177
178public:
180 K2Tree() : pmin_(0, 0), pmax_(0, 0), N_(0), root_(nullptr)
181 {
182 // empty
183 }
184
191 : pmin_(std::move(pmin)), pmax_(std::move(pmax)), N_(0), root_(nullptr)
192 {
193 // empty
194 }
195
203 K2Tree(const Geom_Number & xmin, const Geom_Number & ymin,
204 const Geom_Number & xmax, const Geom_Number & ymax)
205 : pmin_(xmin, ymin), pmax_(xmax, ymax), N_(0), root_(nullptr)
206 {
207 // empty
208 }
209
210 K2Tree(const K2Tree &) = delete;
211
212 K2Tree &operator =(const K2Tree &) = delete;
213
215 K2Tree(K2Tree && other) noexcept
216 : pmin_(std::move(other.pmin_)), pmax_(std::move(other.pmax_)),
217 N_(other.N_), root_(other.root_)
218 {
219 other.N_ = 0;
220 other.root_ = nullptr;
221 }
222
224 K2Tree &operator =(K2Tree && other) noexcept
225 {
226 if (this != &other)
227 {
229 pmin_ = other.pmin_;
230 pmax_ = other.pmax_;
231 N_ = other.N_;
232 root_ = other.root_;
233 other.N_ = 0;
234 other.root_ = nullptr;
235 }
236 return *this;
237 }
238
240 [[nodiscard]] constexpr bool is_empty() const noexcept { return N_ == 0; }
241
243 [[nodiscard]] constexpr size_t size() const noexcept { return N_; }
244
245private:
254 Node * lr_insert(Node *root, const Point & p)
255 {
256 if (root == nullptr)
257 return new Node(p);
258
259 Node *ret_val = nullptr;
260 if (p.get_x() == root->x())
261 {
262 if (p.get_y() == root->y())
263 return nullptr; // Duplicate point
264
265 ret_val = bu_insert(root->rt_, p);
266 if (ret_val != nullptr)
267 {
268 root->rt_ = ret_val; // Node was inserted
269 root->rt_->set_rect(root->x(), root->ymin(),
270 root->xmax(), root->ymax());
271
272 return root;
273 }
274
275 return nullptr;
276 }
277
278 if (p.get_x() < root->x())
279 {
280 ret_val = bu_insert(root->lb_, p);
281 if (ret_val != nullptr)
282 {
283 root->lb_ = ret_val;
284 root->lb_->set_rect(root->xmin(), root->ymin(),
285 root->x(), root->ymax());
286
287 return root;
288 }
289 return nullptr;
290 }
291
292 ret_val = bu_insert(root->rt_, p);
293 if (ret_val != nullptr)
294 {
295 root->rt_ = ret_val;
296 root->rt_->set_rect(root->x(), root->ymin(),
297 root->xmax(), root->ymax());
298
299 return root;
300 }
301
302 return nullptr;
303 }
304
313 Node * bu_insert(Node *root, const Point & p)
314 {
315 if (root == nullptr)
316 return new Node(p);
317
318 Node *ret_val = nullptr;
319 if (p.get_y() == root->y())
320 {
321 if (p.get_x() == root->x())
322 return nullptr; // Duplicate point
323
324 ret_val = lr_insert(root->rt_, p);
325 if (ret_val != nullptr)
326 {
327 root->rt_ = ret_val; // Node was inserted
328 root->rt_->set_rect(root->xmin(), root->y(),
329 root->xmax(), root->ymax());
330
331 return root;
332 }
333
334 return nullptr;
335 }
336
337 if (p.get_y() < root->y())
338 {
339 ret_val = lr_insert(root->lb_, p);
340 if (ret_val != nullptr)
341 {
342 root->lb_ = ret_val;
343 root->lb_->set_rect(root->xmin(), root->ymin(),
344 root->xmax(), root->y());
345 return root;
346 }
347 return nullptr;
348 }
349
350 ret_val = lr_insert(root->rt_, p);
351 if (ret_val != nullptr)
352 {
353 root->rt_ = ret_val;
354 root->rt_->set_rect(root->xmin(), root->y(),
355 root->xmax(), root->ymax());
356
357 return root;
358 }
359
360 return nullptr;
361 }
362
364 [[nodiscard]] bool is_outside_region(const Point & p) const noexcept
365 {
366 return p.get_x() < pmin_.get_x() or p.get_x() > pmax_.get_x() or
367 p.get_y() < pmin_.get_y() or p.get_y() > pmax_.get_y();
368 }
369
373 void extend_region(const Point & p)
374 {
375 pmin_ = Point(std::min(pmin_.get_x(), p.get_x()), std::min(pmin_.get_y(), p.get_y()));
376 pmax_ = Point(std::max(pmax_.get_x(), p.get_x()), std::max(pmax_.get_y(), p.get_y()));
377 set_rects(root_, pmin_, pmax_, true);
378 }
379
384 static void set_rects(Node *node, const Point & rmin, const Point & rmax,
385 const bool split_x)
386 {
387 if (node == nullptr)
388 return;
389
390 node->set_rect(rmin, rmax);
391 if (split_x)
392 {
393 set_rects(node->lb_, rmin, Point(node->x(), rmax.get_y()), false);
394 set_rects(node->rt_, Point(node->x(), rmin.get_y()), rmax, false);
395 }
396 else
397 {
398 set_rects(node->lb_, rmin, Point(rmax.get_x(), node->y()), true);
399 set_rects(node->rt_, Point(rmin.get_x(), node->y()), rmax, true);
400 }
401 }
402
403public:
414 bool insert(const Point & p)
415 {
416 if (root_ == nullptr)
417 {
418 if (is_outside_region(p))
419 extend_region(p);
420 root_ = new Node(p);
422 ++N_;
423 return true;
424 }
425
426 // A point already in the tree is inside the region, which contains
427 // every point inserted
428 if (is_outside_region(p))
429 extend_region(p);
430
431 Node *ret = lr_insert(root_, p);
432 if (ret == nullptr)
433 return false;
434
435 ++N_;
436 return true;
437 }
438
439private:
441 static Node * bu_search(Node *root, const Point & p) noexcept
442 {
443 if (root == nullptr)
444 return nullptr;
445
446 if (root->y() == p.get_y())
447 {
448 if (root->x() == p.get_x())
449 return root;
450
451 return lr_search(root->rt_, p);
452 }
453
454 if (p.get_y() < root->y())
455 return lr_search(root->lb_, p);
456 return lr_search(root->rt_, p);
457 }
458
460 static Node * lr_search(Node *root, const Point & p) noexcept
461 {
462 if (root == nullptr)
463 return nullptr;
464
465 if (root->x() == p.get_x())
466 {
467 if (root->y() == p.get_y())
468 return root;
469
470 return bu_search(root->rt_, p);
471 }
472
473 if (p.get_x() < root->x())
474 return bu_search(root->lb_, p);
475 return bu_search(root->rt_, p);
476 }
477
478public:
480 [[nodiscard]] bool contains(const Point & p) const noexcept
481 {
482 return lr_search(root_, p) != nullptr;
483 }
484
485private:
492 static void range(Node *root, const Rectangle & rect, DynList<Point> *q)
493 {
494 if (root == nullptr)
495 return;
496
497 if (not root->rect_.intersects(rect))
498 return;
499
500 if (const Point & point = root->point_; rect.contains(point))
501 q->append(point);
502
503 range(root->lb_, rect, q);
504 range(root->rt_, rect, q);
505 }
506
507public:
516 void range(const Rectangle & rect, DynList<Point> *l) const
517 {
518 if (N_ == 0)
519 return;
520
521 range(root_, rect, l);
522 }
523
524private:
527 {
528 Node *node = nullptr;
530 };
531
538 static void lr_nearest(Node *root, const Point & p,
539 NearestState & st) noexcept
540 {
541 if (root == nullptr)
542 return;
543
544 if (root->rect_.distance_squared_to(p) > st.dist2)
545 return;
546
547 if (const Geom_Number d2 = root->point_.distance_squared_to(p); d2 < st.dist2)
548 {
549 st.dist2 = d2;
550 st.node = root;
551 }
552
553 if (p.get_x() < root->x()) // Is p to left of this?
554 {
555 bu_nearest(root->lb_, p, st);
556 bu_nearest(root->rt_, p, st);
557 }
558 else
559 {
560 bu_nearest(root->rt_, p, st);
561 bu_nearest(root->lb_, p, st);
562 }
563 }
564
571 static void bu_nearest(Node *root, const Point & p,
572 NearestState & st) noexcept
573 {
574 if (root == nullptr)
575 return;
576
577 if (root->rect_.distance_squared_to(p) > st.dist2)
578 return;
579
580 if (const Geom_Number d2 = root->point_.distance_squared_to(p); d2 < st.dist2)
581 {
582 st.dist2 = d2;
583 st.node = root;
584 }
585
586 if (p.get_y() < root->y()) // Is p below this?
587 {
588 lr_nearest(root->lb_, p, st);
589 lr_nearest(root->rt_, p, st);
590 }
591 else
592 {
593 lr_nearest(root->rt_, p, st);
594 lr_nearest(root->lb_, p, st);
595 }
596 }
597
598public:
607 [[nodiscard]] std::optional<Point> nearest(const Point & p) const noexcept
608 {
609 if (N_ == 0)
610 return std::nullopt;
611
612 NearestState st;
613 st.node = root_;
615
616 lr_nearest(root_, p, st);
617
618 return st.node != nullptr ? std::optional<Point>(st.node->point_) : std::nullopt;
619 }
620
626 template <typename Op>
627 void for_each(Op && op) const
628 {
629 for_each_node(root_, std::forward<Op>(op));
630 }
631
650 [[nodiscard]] static K2Tree build(Array<Point> points,
651 const Point & pmin,
652 const Point & pmax)
653 {
654 // Sort lexicographically and remove duplicates
655 if (points.size() > 1)
656 {
657 Aleph::in_place_sort(points, [](const Point & a, const Point & b)
658 {
659 if (a.get_x() < b.get_x()) return true;
660 if (b.get_x() < a.get_x()) return false;
661 return a.get_y() < b.get_y();
662 });
663
664 size_t w = 1;
665 for (size_t r = 1; r < points.size(); ++r)
666 if (points(r) != points(w - 1))
667 points(w++) = points(r);
668
669 while (points.size() > w)
670 static_cast<void>(points.remove_last());
671 }
672
673 K2Tree tree(pmin, pmax);
674 if (points.is_empty())
675 return tree;
676
677 for (size_t i = 0; i < points.size(); ++i)
678 if (tree.is_outside_region(points(i)))
679 tree.extend_region(points(i)); // no nodes yet: only the region
680
681 tree.root_ = build_balanced(points, 0, points.size(), true,
682 tree.pmin_, tree.pmax_);
683 tree.N_ = points.size();
684 return tree;
685 }
686
687private:
695 const size_t lo, const size_t hi,
696 const bool split_x,
697 const Point & rmin, const Point & rmax)
698 {
699 if (lo >= hi)
700 return nullptr;
701
702 const size_t mid = lo + (hi - lo) / 2;
703
704 if (split_x)
705 std::nth_element(&pts(lo), &pts(lo) + (mid - lo), &pts(lo) + (hi - lo),
706 [](const Point & a, const Point & b)
707 {
708 return a.get_x() < b.get_x();
709 });
710 else
711 std::nth_element(&pts(lo), &pts(lo) + (mid - lo), &pts(lo) + (hi - lo),
712 [](const Point & a, const Point & b)
713 {
714 return a.get_y() < b.get_y();
715 });
716
717 // Ensure the left partition [lo, root_pos) has only elements with
718 // split-coord strictly less than the median, matching the search
719 // invariant (equal goes right).
720 const Geom_Number mv = split_x ? pts(mid).get_x() : pts(mid).get_y();
721
722 size_t strict_end = lo;
723 for (size_t i = lo; i < mid; ++i)
724 if (const Geom_Number v = split_x ? pts(i).get_x() : pts(i).get_y(); v < mv)
725 {
726 if (i != strict_end)
727 {
728 const Point tmp = pts(i);
729 pts(i) = pts(strict_end);
730 pts(strict_end) = tmp;
731 }
732 ++strict_end;
733 }
734
735 // If equal-valued elements were found in [strict_end, mid), move
736 // the median to strict_end so that those elements fall into the
737 // right subtree.
738 size_t root_pos = mid;
739 if (strict_end < mid)
740 {
741 const Point median_pt = pts(mid);
742 pts(mid) = pts(strict_end);
743 pts(strict_end) = median_pt;
744 root_pos = strict_end;
745 }
746
747 Node *node = new Node(pts(root_pos));
748 node->set_rect(rmin, rmax);
749
750 if (split_x)
751 {
752 node->lb_ = build_balanced(pts, lo, root_pos, false,
753 rmin, Point(node->x(), rmax.get_y()));
754 node->rt_ = build_balanced(pts, root_pos + 1, hi, false,
755 Point(node->x(), rmin.get_y()), rmax);
756 }
757 else
758 {
759 node->lb_ = build_balanced(pts, lo, root_pos, true,
760 rmin, Point(rmax.get_x(), node->y()));
761 node->rt_ = build_balanced(pts, root_pos + 1, hi, true,
762 Point(rmin.get_x(), node->y()), rmax);
763 }
764
765 return node;
766 }
767
769 template <typename Op>
770 static void for_each_node(const Node *node, Op && op)
771 {
772 if (node == nullptr)
773 return;
774
775 for_each_node(node->lb_, op);
776 op(node->point_);
777 for_each_node(node->rt_, op);
778 }
779
781 void destroy_tree(Node *node) noexcept
782 {
783 if (node == nullptr)
784 return;
785
786 destroy_tree(node->lb_);
787 destroy_tree(node->rt_);
788 delete node;
789 }
790
791public:
794 {
796 }
797};
798
799# endif // TPL_2DTREE_H
Core definitions, constants, and utility macros for Aleph-w.
High-level sorting functions for Aleph containers.
long double w
Definition btreepic.C:153
Simple dynamic array with automatic resizing and functional operations.
Definition tpl_array.H:141
constexpr size_t size() const noexcept
Return the number of elements stored in the stack.
Definition tpl_array.H:450
constexpr bool is_empty() const noexcept
Checks if the container is empty.
Definition tpl_array.H:444
Doubly-linked list (defined in tpl_dynList.H).
Definition htlist.H:1231
T & append(const T &item)
Definition htlist.H:1362
Represents a point with rectangular coordinates in a 2D plane.
Definition point.H:221
const Geom_Number & get_x() const noexcept
Gets the x-coordinate value.
Definition point.H:448
const Geom_Number & get_y() const noexcept
Gets the y-coordinate value.
Definition point.H:457
Geom_Number distance_squared_to(const Point &that) const
Calculates the squared Euclidean distance to another point.
Definition point.H:1490
An axis-aligned rectangle.
Definition point.H:1789
const Geom_Number & get_xmin() const
Gets the minimum x-coordinate.
Definition point.H:1815
void set_rect(const Geom_Number &xmin, const Geom_Number &ymin, const Geom_Number &xmax, const Geom_Number &ymax)
Sets the coordinates of the rectangle.
Definition point.H:1866
const Geom_Number & get_ymax() const
Gets the maximum y-coordinate.
Definition point.H:1830
const Geom_Number & get_ymin() const
Gets the minimum y-coordinate.
Definition point.H:1820
const Geom_Number & get_xmax() const
Gets the maximum x-coordinate.
Definition point.H:1825
bool contains(const Point &p) const noexcept
Checks if this axis-aligned rectangle contains a point.
Definition point.H:1969
2D k-d tree for efficient spatial point operations.
Definition tpl_2dtree.H:136
bool insert(const Point &p)
Insert a point into the tree.
Definition tpl_2dtree.H:414
static Node * lr_search(Node *root, const Point &p) noexcept
Search with left-right (X) split pattern.
Definition tpl_2dtree.H:460
Point pmax_
Upper-right corner of reference rectangle.
Definition tpl_2dtree.H:174
K2Tree()
Default constructor - creates an empty tree with zero-sized region.
Definition tpl_2dtree.H:180
constexpr size_t size() const noexcept
Get the number of points in the tree.
Definition tpl_2dtree.H:243
K2Tree(Point pmin, Point pmax)
Construct a k-d tree with specified bounding region.
Definition tpl_2dtree.H:190
Node * root_
Root of the tree.
Definition tpl_2dtree.H:176
static void lr_nearest(Node *root, const Point &p, NearestState &st) noexcept
Recursively find the nearest neighbor (X-split level).
Definition tpl_2dtree.H:538
void range(const Rectangle &rect, DynList< Point > *l) const
Find all points within a rectangle.
Definition tpl_2dtree.H:516
void extend_region(const Point &p)
Extend the region so that it contains p, and the rectangles of the nodes, which bound range() and nea...
Definition tpl_2dtree.H:373
static void range(Node *root, const Rectangle &rect, DynList< Point > *q)
Recursively find points within a rectangle.
Definition tpl_2dtree.H:492
K2Tree(const K2Tree &)=delete
Point pmin_
Lower-left corner of reference rectangle.
Definition tpl_2dtree.H:173
K2Tree(K2Tree &&other) noexcept
Move constructor — transfers ownership of all nodes.
Definition tpl_2dtree.H:215
void for_each(Op &&op) const
Apply an operation to every point in the tree (inorder).
Definition tpl_2dtree.H:627
static K2Tree build(Array< Point > points, const Point &pmin, const Point &pmax)
Build a balanced k-d tree from an array of points.
Definition tpl_2dtree.H:650
static Node * build_balanced(Array< Point > &pts, const size_t lo, const size_t hi, const bool split_x, const Point &rmin, const Point &rmax)
Recursively build a balanced subtree selecting medians.
Definition tpl_2dtree.H:694
K2Tree & operator=(const K2Tree &)=delete
Node * bu_insert(Node *root, const Point &p)
Insert into tree with bottom-up (Y) split.
Definition tpl_2dtree.H:313
bool contains(const Point &p) const noexcept
Check if the tree contains a point.
Definition tpl_2dtree.H:480
static void bu_nearest(Node *root, const Point &p, NearestState &st) noexcept
Recursively find the nearest neighbor (Y-split level).
Definition tpl_2dtree.H:571
std::optional< Point > nearest(const Point &p) const noexcept
Find the nearest point to a query point.
Definition tpl_2dtree.H:607
Node * lr_insert(Node *root, const Point &p)
Insert into tree with left-right (X) split.
Definition tpl_2dtree.H:254
static void for_each_node(const Node *node, Op &&op)
Recursive inorder traversal helper for for_each.
Definition tpl_2dtree.H:770
constexpr bool is_empty() const noexcept
Check if the tree is empty.
Definition tpl_2dtree.H:240
K2Tree(const Geom_Number &xmin, const Geom_Number &ymin, const Geom_Number &xmax, const Geom_Number &ymax)
Construct a k-d tree with specified coordinate bounds.
Definition tpl_2dtree.H:203
~K2Tree()
Destructor - frees all nodes.
Definition tpl_2dtree.H:793
bool is_outside_region(const Point &p) const noexcept
Whether p lies outside the region [pmin_, pmax_].
Definition tpl_2dtree.H:364
static void set_rects(Node *node, const Point &rmin, const Point &rmax, const bool split_x)
Give node the rectangle [rmin, rmax], and its subtrees the halves that its point splits,...
Definition tpl_2dtree.H:384
void destroy_tree(Node *node) noexcept
Recursively delete all nodes.
Definition tpl_2dtree.H:781
static Node * bu_search(Node *root, const Point &p) noexcept
Search with bottom-up (Y) split pattern.
Definition tpl_2dtree.H:441
size_t N_
Number of points in the tree.
Definition tpl_2dtree.H:175
__gmp_expr< T, __gmp_binary_expr< __gmp_expr< T, U >, unsigned long int, __gmp_root_function > > root(const __gmp_expr< T, U > &expr, unsigned long int l)
Definition gmpfrxx.h:4138
Singly linked list implementations with head-tail access.
auto pmin(ThreadPool &pool, const Container &c, size_t chunk_size=0)
Parallel minimum element.
DynArray< T > & in_place_sort(DynArray< T > &c, Cmp cmp=Cmp())
Sorts a DynArray in place.
Definition ahSort.H:328
auto pmax(ThreadPool &pool, const Container &c, size_t chunk_size=0)
Parallel maximum element.
STL namespace.
2D point and geometric utilities.
Empty placeholder class with no data members.
Definition ahDefs.H:107
Thread-local state for nearest-neighbor recursion.
Definition tpl_2dtree.H:527
Internal node structure for the k-d tree.
Definition tpl_2dtree.H:139
Point point_
The point stored at this node.
Definition tpl_2dtree.H:140
const Geom_Number & ymin() const noexcept
Definition tpl_2dtree.H:166
const Geom_Number & xmin() const noexcept
Definition tpl_2dtree.H:165
const Geom_Number & x() const noexcept
Definition tpl_2dtree.H:169
Node * rt_
Right/top subtree.
Definition tpl_2dtree.H:143
void set_rect(const Geom_Number &xmin, const Geom_Number &ymin, const Geom_Number &xmax, const Geom_Number &ymax) noexcept
Set the rectangular region for this node.
Definition tpl_2dtree.H:153
const Geom_Number & y() const noexcept
Definition tpl_2dtree.H:170
Node(Point p) noexcept
Construct a node with a given point.
Definition tpl_2dtree.H:146
const Geom_Number & ymax() const noexcept
Definition tpl_2dtree.H:168
void set_rect(const Point &pmin, const Point &pmax) noexcept
Set the rectangular region using corner points.
Definition tpl_2dtree.H:160
const Geom_Number & xmax() const noexcept
Definition tpl_2dtree.H:167
Node * lb_
Left/bottom subtree.
Definition tpl_2dtree.H:142
Rectangle rect_
The axis-aligned rectangle for this node's region.
Definition tpl_2dtree.H:141
Gsl_Compatible_Rng r
Dynamic array container with automatic resizing.
DynList< int > l