#ifndef SPACE_ANALYZER_HPP #define SPACE_ANALYZER_HPP #include "busbar_config.hpp" #include #include class SpaceAnalyzer { private: const BusbarConfig& config_; const std::vector& obstacles_; uint64_t xsize_, ysize_, zsize_; size_t getIndex(int64_t x, int64_t y, int64_t z) const { return x + y * xsize_ + z * xsize_ * ysize_; } public: SpaceAnalyzer(const BusbarConfig& config, const std::vector& obstacles, uint64_t xsize, uint64_t ysize, uint64_t zsize) : config_(config), obstacles_(obstacles), xsize_(xsize), ysize_(ysize), zsize_(zsize) {} // 检查体素是否为障碍物 bool isObstacle(int64_t x, int64_t y, int64_t z) const; bool isObstacle(const Point& p) const; // 检查体素是否在边界内 bool isInBounds(int64_t x, int64_t y, int64_t z) const; bool isInBounds(const Point& p) const; // 检查体素是否可通过(考虑间隙) bool isVoxelFree(const Point& p) const; // 检查某个点在给定方向上是否有足够空间 bool hasSpace(const Point& p, const Vector3& tangent, const Vector3& normal) const; // 获取地图尺寸 uint64_t xsize() const { return xsize_; } uint64_t ysize() const { return ysize_; } uint64_t zsize() const { return zsize_; } }; #endif