You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
1.3 KiB

2 weeks ago
#ifndef SPACE_ANALYZER_HPP
#define SPACE_ANALYZER_HPP
#include "busbar_config.hpp"
#include <vector>
#include <cstdint>
class SpaceAnalyzer {
private:
const BusbarConfig& config_;
const std::vector<bool>& 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<bool>& 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;
// ����ij�����ڸ����������Ƿ����㹻�ռ�
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