Spaces:
Build error
Build error
File size: 1,840 Bytes
1dd0e3b | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | #pragma once
#include <string>
#include <vector>
#include <map>
#include "stl_parser.h"
#include "geometry_api.h"
#include "AICommandManager.h"
namespace hhb {
namespace algorithm {
class GeometryExpert {
public:
GeometryExpert() = default;
~GeometryExpert() = default;
/**
* 执行几何分析命令
* @param jsonCommand JSON格式的命令
* @return JSON格式的执行结果
*/
std::string executeCommand(const std::string& jsonCommand);
/**
* 加载模型数据
* @param pool 三角形对象池
*/
void loadModelFromPool(core::ObjectPool<core::Triangle>& pool);
/**
* 加载模型文件
* @param filename 模型文件路径
* @return 是否加载成功
*/
bool loadModel(const std::string& filename);
/**
* 清除模型数据
*/
void clear();
private:
core::GeometryAPI geometryAPI;
bool modelLoaded = false;
int m_injected_normal_errors = 0;
int m_injected_isolated_vertices = 0;
/**
* 解析JSON命令
* @param jsonCommand JSON命令字符串
* @return 命令类型和参数
*/
std::pair<std::string, std::map<std::string, std::string>> parseJsonCommand(const std::string& jsonCommand);
/**
* 生成JSON响应
* @param success 是否成功
* @param message 消息
* @param data 数据
* @return JSON字符串
*/
std::string generateJsonResponse(bool success, const std::string& message, const std::string& data = "");
/**
* 检查法线一致性
* @return 反向法线的面片数量
*/
int checkNormalConsistency();
/**
* 检查孤立顶点
* @return 孤立顶点的数量
*/
int checkIsolatedVertices();
};
} // namespace algorithm
} // namespace hhb |