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.
56 lines
2.1 KiB
56 lines
2.1 KiB
|
5 days ago
|
#ifndef DEBUG_EXPORT_HPP
|
||
|
|
#define DEBUG_EXPORT_HPP
|
||
|
|
|
||
|
|
#include "busbar_segment.hpp"
|
||
|
|
#include <vector>
|
||
|
|
#include <string>
|
||
|
|
#include <fstream>
|
||
|
|
#include <memory>
|
||
|
|
#include <set>
|
||
|
|
|
||
|
|
class DebugExporter {
|
||
|
|
public:
|
||
|
|
// 导出路径占用的所有体素为OBJ文件(立方体形式)
|
||
|
|
static void exportPathToOBJ(
|
||
|
|
const std::vector<std::shared_ptr<BusbarSegment>>& segments,
|
||
|
|
const std::string& filename);
|
||
|
|
|
||
|
|
// 导出体素点云为OBJ文件(每个体素一个小立方体)
|
||
|
|
static void exportVoxelsToOBJ(
|
||
|
|
const std::vector<Point>& voxels,
|
||
|
|
const std::string& filename,
|
||
|
|
float voxel_size = 1.0f);
|
||
|
|
|
||
|
|
// 导出多组体素,用不同的组名区分(可在3D软件中分别显示/隐藏)
|
||
|
|
static void exportMultipleVoxelGroupsToOBJ(
|
||
|
|
const std::vector<std::pair<std::string, std::vector<Point>>>& groups,
|
||
|
|
const std::string& filename);
|
||
|
|
|
||
|
|
// 导出障碍物地图为OBJ
|
||
|
|
static void exportObstaclesToOBJ(
|
||
|
|
const std::vector<bool>& obstacles,
|
||
|
|
uint64_t xsize, uint64_t ysize, uint64_t zsize,
|
||
|
|
const std::string& filename,
|
||
|
|
int64_t x_min = -1, int64_t x_max = -1, // -1表示全部
|
||
|
|
int64_t y_min = -1, int64_t y_max = -1,
|
||
|
|
int64_t z_min = -1, int64_t z_max = -1);
|
||
|
|
|
||
|
|
// 导出路径为OBJ,相邻段用交替颜色区分(用于调试原始路径)
|
||
|
|
static void exportPathToOBJ_alternating(
|
||
|
|
const std::vector<std::shared_ptr<BusbarSegment>>& segments,
|
||
|
|
const std::string& filename);
|
||
|
|
|
||
|
|
// 导出障碍物和间隙体素为OBJ(用不同颜色区分)
|
||
|
|
// obstacles: 实体障碍物(红色)
|
||
|
|
// collision_voxels: 间隙碰撞体素(蓝色)
|
||
|
|
static void exportObstaclesWithCollisionToOBJ(
|
||
|
|
const std::vector<bool>& obstacles,
|
||
|
|
const std::vector<bool>& collision_voxels,
|
||
|
|
uint64_t xsize, uint64_t ysize, uint64_t zsize,
|
||
|
|
const std::string& filename,
|
||
|
|
int64_t x_min = -1, int64_t x_max = -1,
|
||
|
|
int64_t y_min = -1, int64_t y_max = -1,
|
||
|
|
int64_t z_min = -1, int64_t z_max = -1);
|
||
|
|
};
|
||
|
|
|
||
|
|
#endif
|