39#include <gtest/gtest.h>
43#include <unordered_set>
233 for (
int i = 1; i <= 10; ++i)
302 std::vector<Point> points = {
307 for (
const auto & p : points)
314 for (
const auto & p : points)
387 std::mt19937
gen(12345);
388 std::uniform_real_distribution<>
dis(0, 1000);
391 std::vector<Point> points;
402 for (
const auto & p : points)
412 std::mt19937
gen(54321);
413 std::uniform_real_distribution<>
dis(0, 100);
415 const size_t cycles = 100;
420 std::vector<Point> points;
447 for (
int x = 40; x <= 60; ++x)
449 for (
int y = 40;
y <= 60; ++
y)
456 for (
int x = 40; x <= 60; ++x)
458 for (
int y = 40;
y <= 60; ++
y)
542 for (
int i = 0; i < 10; ++i)
547 size_t node_count = 0;
582 std::mt19937
gen(99999);
584 std::uniform_int_distribution<int>
coord_dis(0, 999);
585 std::uniform_int_distribution<>
op_dis(0, 2);
590 for (
int i = 0; i < 1000; ++i)
594 if (op == 0 || op == 1)
598 if (result !=
nullptr)
615 <<
"Point (" << p.get_x() <<
", " << p.get_y() <<
") should be in tree";
624 ::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.
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).
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.
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)
and
Check uniqueness with explicit hash + equality functors.
Divide_Conquer_DP_Result< Cost > divide_and_conquer_partition_dp(const size_t groups, const size_t n, Transition_Cost_Fn transition_cost, const Cost inf=dp_optimization_detail::default_inf< Cost >())
Optimize partition DP using divide-and-conquer optimization.
static bool is_leaf(BinNode< std::string > *p) noexcept
QuadTree spatial data structure for efficient 2D point indexing.