2026-07-23 05:27:51 +00:00
|
|
|
#pragma once
|
|
|
|
|
#include "vde/core/aabb.h"
|
|
|
|
|
#include "vde/core/line.h"
|
2026-07-23 08:19:24 +00:00
|
|
|
#include "vde/core/triangle.h"
|
2026-07-23 05:27:51 +00:00
|
|
|
#include <vector>
|
|
|
|
|
#include <memory>
|
|
|
|
|
|
|
|
|
|
namespace vde::spatial {
|
2026-07-23 08:19:24 +00:00
|
|
|
using core::AABB3D;
|
|
|
|
|
using core::Point3D;
|
|
|
|
|
using core::Ray3Dd;
|
|
|
|
|
using core::Triangle3D;
|
2026-07-23 05:27:51 +00:00
|
|
|
|
|
|
|
|
template <typename T>
|
|
|
|
|
class SpatialIndex {
|
|
|
|
|
public:
|
|
|
|
|
virtual ~SpatialIndex() = default;
|
|
|
|
|
virtual void build(const std::vector<T>& items) = 0;
|
|
|
|
|
virtual void insert(const T& item) = 0;
|
|
|
|
|
virtual bool remove(const T& item) = 0;
|
|
|
|
|
virtual std::vector<T> query_range(const AABB3D& range) const = 0;
|
|
|
|
|
virtual std::vector<T> query_knn(const Point3D& point, size_t k) const = 0;
|
|
|
|
|
virtual std::vector<T> query_ray(const Ray3Dd& ray) const = 0;
|
|
|
|
|
virtual void clear() = 0;
|
|
|
|
|
virtual size_t size() const = 0;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace vde::spatial
|