39#include <gtest/gtest.h>
43#include <unordered_set>
268 for (
int i = 1; i <= 10; ++i)
337 std::vector<Point> points = {
342 for (
const auto & p : points)
349 for (
const auto & p : points)
362 const Point p1(1, 1);
363 const Point p2(2, 2);
364 const Point p3(3, 3);
447 std::mt19937
gen(12345);
448 std::uniform_real_distribution<>
dis(0, 1000);
451 std::vector<Point> points;
462 for (
const auto & p : points)
472 std::mt19937
gen(54321);
473 std::uniform_real_distribution<>
dis(0, 100);
475 const size_t cycles = 100;
480 std::vector<Point> points;
507 for (
int x = 40; x <= 60; ++x)
509 for (
int y = 40;
y <= 60; ++
y)
516 for (
int x = 40; x <= 60; ++x)
518 for (
int y = 40;
y <= 60; ++
y)
573 const Point duplicate(25, 25);
575 for (
size_t i = 0; i < 100; ++i)
581 for (
size_t i = 0; i < 100; ++i)
620 for (
int i = 0; i < 10; ++i)
625 size_t node_count = 0;
660 std::mt19937
gen(99999);
662 std::uniform_int_distribution<int>
coord_dis(0, 999);
663 std::uniform_int_distribution<>
op_dis(0, 2);
668 for (
int i = 0; i < 1000; ++i)
672 if (op == 0 || op == 1)
676 if (result !=
nullptr)
693 <<
"Point (" << p.get_x() <<
", " << p.get_y() <<
") should be in tree";
702 ::testing::InitGoogleTest(&
argc,
argv);
Represents a point with rectangular coordinates in a 2D plane.
const Geom_Number & get_x() const noexcept
Gets the x-coordinate value.
const Geom_Number & get_y() const noexcept
Gets the y-coordinate value.
Node for QuadTree spatial data structure.
const Geom_Number & get_min_y() const noexcept
Get minimum Y coordinate of this region.
const Geom_Number & get_max_y() const noexcept
Get maximum Y coordinate of this region.
const Geom_Number & get_min_x() const noexcept
Get minimum X coordinate of this region.
void set_region(const Geom_Number &_min_x, const Geom_Number &_max_x, const Geom_Number &_min_y, const Geom_Number &_max_y)
Set the region boundaries for this node.
Point * search_point(const Point &p) noexcept
Search for a point in this node.
bool is_leaf() const noexcept
Check if this node is a leaf (has no children).
size_t get_num_points() noexcept
Get total number of points in this subtree.
const Geom_Number & get_max_x() const noexcept
Get maximum X coordinate of this region.
QuadTree - Hierarchical spatial index for 2D points.
void empty(Node *&r) noexcept
Recursively delete all nodes.
void clear()
Alias for empty().
void for_each(Op &op)
Apply an operation to each node in the tree.
void remove(const Point &p)
Remove a point from the tree.
Point * search(const Point &p) noexcept
Search for a point in the tree.
Node * search_container_node(const Point &p) noexcept
Find the leaf node containing a point.
void set_max_num_points_per_node(const size_t &_max_num_points_per_node)
Set the maximum points per leaf node.
bool contains(const Point &p) const noexcept
Check if a point is within the tree's region.
Point * insert(Node *&r, const Point &p)
Recursive insert helper.
size_t get_max_num_points_per_node() const noexcept
Get the maximum points per leaf node.
Node * get_root() noexcept
Get the root node.
__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)
size_t blossom_maximum_cardinality_matching(const GT &g, DynDlist< typename GT::Arc * > &matching, SA sa=SA())
Alias of compute_maximum_cardinality_general_matching().
and
Check uniqueness with explicit hash + equality functors.
static bool is_leaf(BinNode< std::string > *p) noexcept
QuadTree spatial data structure for efficient 2D point indexing.