fix(v1.0.1): VDE-011/012/013 — write_stl return bool, StlTrianglef, module options
VDE-011 (Medium): write_stl / write_stl_ascii return bool - Return false on file open failure, true on success VDE-012 (Low): StlTrianglef for float precision - New StlTrianglef struct with Vector3F/Point3F - to_stl_trianglef() / from_stl_trianglef() conversions VDE-013 (Medium): Per-module build options - VDE_BUILD_CURVES/MESH/BREP/SPATIAL/BOOLEAN/COLLISION/SKETCH/SDF/CAPI - All default ON, parent project can set OFF
This commit is contained in:
@@ -92,6 +92,7 @@ std::vector<StlTriangle> read_stl(const std::string& filepath);
|
||||
* @ingroup foundation
|
||||
*/
|
||||
void write_stl(const std::string& filepath, const std::vector<StlTriangle>& tris);
|
||||
bool write_stl(const std::string& filepath, const std::vector<StlTriangle>& tris);
|
||||
|
||||
/**
|
||||
* @brief 写入 ASCII STL 文件
|
||||
@@ -100,17 +101,36 @@ void write_stl(const std::string& filepath, const std::vector<StlTriangle>& tris
|
||||
*
|
||||
* @param filepath 输出文件路径
|
||||
* @param tris 三角形面片列表
|
||||
* @return true 写入成功,false 文件创建失败
|
||||
*
|
||||
* @warning ASCII STL 文件体积约为二进制 STL 的 5-10 倍,不适合大规模网格
|
||||
*
|
||||
* @code{.cpp}
|
||||
* std::vector<StlTriangle> tris = // ...;
|
||||
* write_stl_ascii("debug.stl", tris); // 可读文本,便于调试
|
||||
* if (!write_stl_ascii("debug.stl", tris)) {
|
||||
* std::cerr << "Failed to write STL\n";
|
||||
* }
|
||||
* @endcode
|
||||
*
|
||||
* @see read_stl, write_stl
|
||||
* @ingroup foundation
|
||||
*/
|
||||
void write_stl_ascii(const std::string& filepath, const std::vector<StlTriangle>& tris);
|
||||
bool write_stl_ascii(const std::string& filepath, const std::vector<StlTriangle>& tris);
|
||||
|
||||
/**
|
||||
* @brief float 精度 STL 三角形
|
||||
*
|
||||
* 用于与 float 网格数据直接交互,避免 double↔float 显式转换。
|
||||
*/
|
||||
struct StlTrianglef {
|
||||
Vector3F normal;
|
||||
Point3F v0, v1, v2;
|
||||
};
|
||||
|
||||
/// 转换 double → float 精度
|
||||
StlTrianglef to_stl_trianglef(const StlTriangle& t);
|
||||
/// 转换 float → double 精度
|
||||
StlTriangle from_stl_trianglef(const StlTrianglef& t);
|
||||
|
||||
} // namespace vde::foundation
|
||||
|
||||
Reference in New Issue
Block a user