feat: P0 全部实现 + 差异化功能分析
P0 实现(11/11 完成,0 stub 残留): - mesh: QEM 简化、Laplacian 平滑、质量评估、修复、3D 布尔 - spatial: Octree、KD-Tree、R-Tree 完整实现 - collision: GJK 距离+EPA 穿透深度、SAT、Tri-Tri 相交 - boolean: Vatti 2D 布尔扫描线算法 - core: 3D 凸包 QuickHull - spatial/BVH: 最近命中查询(AABB slab + Möller-Trumbore) 文档新增: - 05-核心竞争力与差异化功能(14 项独有功能) - SRS 扩展到 16 类 FR、100+ 条目 - 杀手功能:约束求解器/SDF隐式建模/可微分几何/惰性管线/Python绑定
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
#include "vde/spatial/spatial_index.h"
|
||||
#include <vector>
|
||||
|
||||
namespace vde::spatial {
|
||||
|
||||
|
||||
@@ -1,13 +1,16 @@
|
||||
#pragma once
|
||||
#include "vde/spatial/spatial_index.h"
|
||||
#include <memory>
|
||||
|
||||
namespace vde::spatial {
|
||||
|
||||
template <typename T> struct OctreeNode;
|
||||
template <typename T> struct OctreeData;
|
||||
|
||||
template <typename T>
|
||||
class Octree : public SpatialIndex<T> {
|
||||
public:
|
||||
explicit Octree(int max_depth = 8, int max_items = 16)
|
||||
: max_depth_(max_depth), max_items_(max_items) {}
|
||||
explicit Octree(int max_depth = 8, int max_items = 16);
|
||||
void build(const std::vector<T>& items) override;
|
||||
void insert(const T& item) override;
|
||||
bool remove(const T& item) override;
|
||||
@@ -15,10 +18,13 @@ public:
|
||||
std::vector<T> query_knn(const Point3D& point, size_t k) const override;
|
||||
std::vector<T> query_ray(const Ray3Dd& ray) const override;
|
||||
void clear() override;
|
||||
size_t size() const override { return count_; }
|
||||
size_t size() const override;
|
||||
private:
|
||||
void insert_recursive(int node_idx, const T& item, int depth);
|
||||
void subdivide_recursive(int node_idx, int depth);
|
||||
void query_range_recursive(int node_idx, const AABB3D& range, std::vector<T>& result) const;
|
||||
std::shared_ptr<OctreeData<T>> data_;
|
||||
int max_depth_, max_items_;
|
||||
size_t count_ = 0;
|
||||
};
|
||||
|
||||
} // namespace vde::spatial
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
#include "vde/spatial/spatial_index.h"
|
||||
#include "vde/core/aabb.h"
|
||||
|
||||
namespace vde::spatial {
|
||||
|
||||
@@ -15,6 +16,8 @@ public:
|
||||
void clear() override;
|
||||
size_t size() const override { return count_; }
|
||||
private:
|
||||
std::vector<T> items_;
|
||||
std::vector<AABB3D> bounds_;
|
||||
size_t count_ = 0;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user