- corner_blend 端点分类新增 bridges(=2 目标边):球面切点收敛 + 双三角 cap 闭合, 整圈闭环/3 边链/变半径网络 free=0、watertightness>0.99、体积误差达标 - 修复导入模型空控制网格 NURBS 曲线 evaluate 越界崩溃(edge_curve 回退直线) - RealFileCornerBlendPassRate 扩展覆盖 corpus/real(3800+ 真实 CAD 语料抽样): 模型级 19/81、边级 77/2160、成功项水密 74/77,无崩溃
554 lines
21 KiB
C++
554 lines
21 KiB
C++
/// @file test_model_corpus.cpp
|
||
/// @brief D2: 真实测试模型库遍历测试
|
||
///
|
||
/// 遍历 tests/data/corpus/ 下所有模型文件,按格式分发到对应导入器:
|
||
/// 1. STEP (.step/.stp/.p21) -> import_step
|
||
/// 2. IGES (.igs/.iges) -> import_iges
|
||
/// 3. STL (.stl) -> read_stl
|
||
/// 4. DXF (.dxf) -> import_dxf
|
||
/// 5. SAT (.sat) -> import_acis_sat
|
||
/// 6. XT (.x_t/.xt) -> import_parasolid_xt(若可用)
|
||
///
|
||
/// 对每个文件:
|
||
/// - 导入过程不允许崩溃(异常也算失败,但先捕获记录)
|
||
/// - 统计每种格式的成功率,输出失败明细供分析
|
||
///
|
||
/// 目录中无模型文件时测试自动跳过(CI 环境)。
|
||
/// 通过 CMake 注入 TEST_MODEL_DIR 指向模型库根目录。
|
||
///
|
||
/// 注:为避免 MinGW GCC 8.1 std::filesystem 的 wchar path 转换 bug,
|
||
/// 使用 POSIX dirent 递归遍历目录。
|
||
|
||
#include <gtest/gtest.h>
|
||
#include "vde/brep/format_io.h"
|
||
#include "vde/brep/step_import.h"
|
||
#include "vde/brep/iges_import.h"
|
||
#include "vde/brep/dxf_import.h"
|
||
#include "vde/brep/brep_heal.h"
|
||
#include "vde/brep/brep_validate.h"
|
||
#include "vde/brep/advanced_blend.h"
|
||
#include "vde/foundation/io_stl.h"
|
||
#include "vde/foundation/industrial_formats.h"
|
||
|
||
#include <algorithm>
|
||
#include <cctype>
|
||
#include <chrono>
|
||
#include <iostream>
|
||
#include <map>
|
||
#include <string>
|
||
#include <vector>
|
||
|
||
#ifdef _WIN32
|
||
#include <windows.h>
|
||
#else
|
||
#include <dirent.h>
|
||
#include <sys/stat.h>
|
||
#endif
|
||
|
||
#ifndef TEST_MODEL_DIR
|
||
#define TEST_MODEL_DIR "tests/data/corpus"
|
||
#endif
|
||
|
||
/// 真实工业模型库(用户交付的 STEP/IGES 等真实零件,G1 realfile 接入)
|
||
#ifndef TEST_REALFILE_DIR
|
||
#define TEST_REALFILE_DIR "tests/data/realfile"
|
||
#endif
|
||
|
||
/// M5/M6 语料(3800+ 真实工业 CAD 模型,H1 通过率基准)
|
||
#ifndef TEST_REAL_CORPUS_DIR
|
||
#define TEST_REAL_CORPUS_DIR "tests/data/corpus/real"
|
||
#endif
|
||
|
||
/// G1 三率测试参数(真实模型体积大,导入/修复/验证耗时不可控):
|
||
/// - 单文件大小上限:超过则跳过(记为 too_large,不参与三率统计)
|
||
/// - 全局时间预算:累计耗时超过则提前结束(防止 CI 卡死)
|
||
static const double kRealfileMaxMB = 5.0;
|
||
static const double kRealfileBudgetSec = 600.0;
|
||
|
||
/// 文件大小(字节);获取失败返回 -1
|
||
long long file_size_bytes(const std::string& path) {
|
||
#ifdef _WIN32
|
||
WIN32_FILE_ATTRIBUTE_DATA ad;
|
||
if (GetFileAttributesExA(path.c_str(), GetFileExInfoStandard, &ad))
|
||
return (static_cast<long long>(ad.nFileSizeHigh) << 32) + ad.nFileSizeLow;
|
||
return -1;
|
||
#else
|
||
struct stat st;
|
||
if (stat(path.c_str(), &st) == 0) return st.st_size;
|
||
return -1;
|
||
#endif
|
||
}
|
||
|
||
using namespace vde::brep;
|
||
using namespace vde::foundation;
|
||
|
||
namespace {
|
||
|
||
/// 收集目录下所有文件(递归)
|
||
void collect_files(const std::string& root, std::vector<std::string>& out) {
|
||
#ifdef _WIN32
|
||
// Windows: 使用 FindFirstFile 递归(兼容 MinGW 无 dirent 的环境)
|
||
std::string pattern = root + "/*";
|
||
WIN32_FIND_DATAA fd;
|
||
HANDLE h = FindFirstFileA(pattern.c_str(), &fd);
|
||
if (h == INVALID_HANDLE_VALUE) return;
|
||
do {
|
||
std::string name = fd.cFileName;
|
||
if (name == "." || name == "..") continue;
|
||
std::string full = root + "/" + name;
|
||
if (fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
|
||
if (name != "generated") // generated/ 为生成脚本中间产物,跳过
|
||
collect_files(full, out);
|
||
} else if (name != ".gitkeep") {
|
||
out.push_back(full);
|
||
}
|
||
} while (FindNextFileA(h, &fd));
|
||
FindClose(h);
|
||
#else
|
||
DIR* dir = opendir(root.c_str());
|
||
if (!dir) return;
|
||
struct dirent* ent;
|
||
while ((ent = readdir(dir)) != nullptr) {
|
||
std::string name = ent->d_name;
|
||
if (name == "." || name == "..") continue;
|
||
std::string full = root + "/" + name;
|
||
struct stat st;
|
||
if (stat(full.c_str(), &st) == 0) {
|
||
if (S_ISDIR(st.st_mode)) {
|
||
collect_files(full, out);
|
||
} else if (name != ".gitkeep") {
|
||
out.push_back(full);
|
||
}
|
||
}
|
||
}
|
||
closedir(dir);
|
||
#endif
|
||
}
|
||
|
||
/// 获取扩展名(小写,含点号)
|
||
std::string extension_lower(const std::string& path) {
|
||
auto pos = path.find_last_of(".\\/");
|
||
std::string ext;
|
||
if (pos != std::string::npos && path[pos] == '.') {
|
||
ext = path.substr(pos);
|
||
}
|
||
std::transform(ext.begin(), ext.end(), ext.begin(),
|
||
[](unsigned char c) { return static_cast<char>(std::tolower(c)); });
|
||
return ext;
|
||
}
|
||
|
||
/// 每种格式的统计
|
||
struct FormatStats {
|
||
std::string name;
|
||
bool require_ok = true; ///< 为 true 时断言该格式至少成功导入 1 个
|
||
int total = 0;
|
||
int ok = 0;
|
||
int empty = 0; ///< 导入完成但结果为空(可能是不支持的特性)
|
||
int error = 0; ///< 抛出异常
|
||
std::vector<std::string> failed_files;
|
||
std::vector<std::string> error_files;
|
||
|
||
void report() const {
|
||
std::cerr << " [" << name << "] " << ok << "/" << total
|
||
<< " imported (" << empty << " empty, " << error << " error)\n";
|
||
const size_t kMaxList = 50;
|
||
size_t shown = 0;
|
||
for (const auto& f : failed_files) {
|
||
if (shown >= kMaxList) break;
|
||
std::cerr << " [empty] " << f << "\n";
|
||
++shown;
|
||
}
|
||
if (failed_files.size() > shown)
|
||
std::cerr << " ... 另有 " << (failed_files.size() - shown)
|
||
<< " 个 empty 未列出\n";
|
||
shown = 0;
|
||
for (const auto& f : error_files) {
|
||
if (shown >= kMaxList) break;
|
||
std::cerr << " [error] " << f << "\n";
|
||
++shown;
|
||
}
|
||
if (error_files.size() > shown)
|
||
std::cerr << " ... 另有 " << (error_files.size() - shown)
|
||
<< " 个 error 未列出\n";
|
||
}
|
||
};
|
||
|
||
/// 按格式分发导入。返回 true 表示导入结果非空。
|
||
/// 异常会向外抛出(由调用方捕获记录)。
|
||
bool import_by_format(const std::string& f, const std::string& ext) {
|
||
if (ext == ".step" || ext == ".stp" || ext == ".p21") {
|
||
auto models = import_step(f);
|
||
return !models.empty();
|
||
}
|
||
if (ext == ".igs" || ext == ".iges") {
|
||
auto models = import_iges(f);
|
||
return !models.empty();
|
||
}
|
||
if (ext == ".stl") {
|
||
auto tris = read_stl(f);
|
||
return !tris.empty();
|
||
}
|
||
if (ext == ".dxf") {
|
||
auto res = import_dxf(f);
|
||
return res.entities_parsed > 0 && !res.contours.empty();
|
||
}
|
||
if (ext == ".sat") {
|
||
auto m = vde::io::import_acis_sat(f);
|
||
return m.num_faces() > 0;
|
||
}
|
||
if (ext == ".xt" || ext == ".x_t") {
|
||
auto m = vde::io::import_parasolid_xt(f);
|
||
return m.num_faces() > 0;
|
||
}
|
||
return false; // 未知格式
|
||
}
|
||
|
||
/// 判断扩展名是否参与批量导入
|
||
bool is_known_format(const std::string& ext) {
|
||
return ext == ".step" || ext == ".stp" || ext == ".p21" ||
|
||
ext == ".igs" || ext == ".iges" || ext == ".stl" ||
|
||
ext == ".dxf" || ext == ".sat" || ext == ".xt" || ext == ".x_t";
|
||
}
|
||
|
||
/// 导入 → 自动修复 → 验证 三率流水线(G1 真实模型验收)。
|
||
/// 返回 true 表示导入非空;healed 记录 automatic_heal 无异常且修复后面数>0;
|
||
/// validated 记录修复后 validate() 水密通过(valid 且 watertightness>0.99)。
|
||
/// 非 STEP/IGES 格式只统计导入率(healed/validated 置 true,不做深查)。
|
||
bool import_heal_validate(const std::string& f, const std::string& ext,
|
||
bool& healed, bool& validated) {
|
||
healed = false;
|
||
validated = false;
|
||
std::vector<BrepModel> models;
|
||
if (ext == ".step" || ext == ".stp" || ext == ".p21") {
|
||
models = import_step(f);
|
||
} else if (ext == ".igs" || ext == ".iges") {
|
||
models = import_iges(f);
|
||
} else {
|
||
bool ok = import_by_format(f, ext);
|
||
if (ok) { healed = true; validated = true; }
|
||
return ok;
|
||
}
|
||
if (models.empty()) return false;
|
||
for (auto& m : models) {
|
||
automatic_heal(m);
|
||
healed = true;
|
||
auto vr = validate(m);
|
||
if (vr.valid && vr.watertightness > 0.99) validated = true;
|
||
}
|
||
return true;
|
||
}
|
||
|
||
} // namespace
|
||
|
||
// ═══════════════════════════════════════════════════════════
|
||
// 模型库遍历测试
|
||
// ═══════════════════════════════════════════════════════════
|
||
|
||
TEST(ModelCorpus, DirectoryHasFiles) {
|
||
std::vector<std::string> files;
|
||
collect_files(TEST_MODEL_DIR, files);
|
||
if (files.empty()) {
|
||
GTEST_SKIP() << "模型库为空(" << TEST_MODEL_DIR
|
||
<< "),请添加模型文件后重试";
|
||
}
|
||
EXPECT_FALSE(files.empty());
|
||
}
|
||
|
||
TEST(ModelCorpus, AllFilesImportWithoutCrash) {
|
||
std::vector<std::string> files;
|
||
collect_files(TEST_MODEL_DIR, files);
|
||
if (files.empty()) {
|
||
GTEST_SKIP() << "模型库为空,跳过导入测试";
|
||
}
|
||
|
||
std::map<std::string, FormatStats> stats;
|
||
auto init_stats = [](const char* name) {
|
||
FormatStats s; s.name = name; return s;
|
||
};
|
||
stats[".step"] = init_stats("STEP"); stats[".stp"] = init_stats("STEP"); stats[".p21"] = init_stats("STEP");
|
||
stats[".igs"] = init_stats("IGES"); stats[".iges"] = init_stats("IGES");
|
||
stats[".stl"] = init_stats("STL");
|
||
stats[".dxf"] = init_stats("DXF");
|
||
stats[".sat"] = init_stats("SAT");
|
||
stats[".xt"] = init_stats("XT"); stats[".x_t"] = init_stats("XT");
|
||
|
||
int total = 0, ok = 0;
|
||
for (const auto& f : files) {
|
||
auto ext = extension_lower(f);
|
||
if (!is_known_format(ext)) continue; // README / 未知格式不参与导入
|
||
|
||
++total;
|
||
auto& st = stats[ext];
|
||
++st.total;
|
||
|
||
try {
|
||
bool imported = import_by_format(f, ext);
|
||
if (imported) {
|
||
++ok; ++st.ok;
|
||
} else {
|
||
++st.empty;
|
||
st.failed_files.push_back(f);
|
||
}
|
||
} catch (const std::exception& e) {
|
||
++st.error;
|
||
st.error_files.push_back(f + " (" + e.what() + ")");
|
||
} catch (...) {
|
||
++st.error;
|
||
st.error_files.push_back(f + " (unknown exception)");
|
||
}
|
||
}
|
||
|
||
// 汇总:先按格式打印,去重 STEP/IGES 等合并条目
|
||
std::cerr << "[corpus] " << ok << "/" << total << " imported\n";
|
||
std::map<std::string, FormatStats> merged;
|
||
for (auto& kv : stats) {
|
||
if (kv.second.total == 0) continue;
|
||
auto& m = merged[kv.second.name];
|
||
m.name = kv.second.name;
|
||
m.require_ok = m.require_ok && kv.second.require_ok;
|
||
m.total += kv.second.total;
|
||
m.ok += kv.second.ok;
|
||
m.empty += kv.second.empty;
|
||
m.error += kv.second.error;
|
||
m.failed_files.insert(m.failed_files.end(),
|
||
kv.second.failed_files.begin(), kv.second.failed_files.end());
|
||
m.error_files.insert(m.error_files.end(),
|
||
kv.second.error_files.begin(), kv.second.error_files.end());
|
||
}
|
||
for (auto& kv : merged) kv.second.report();
|
||
|
||
if (total > 0) {
|
||
EXPECT_GT(ok, 0) << "所有模型均导入失败";
|
||
// 每种格式至少成功导入 1 个(用于发现某格式导入器整体失效)
|
||
for (auto& kv : merged) {
|
||
if (!kv.second.require_ok) continue;
|
||
SCOPED_TRACE("格式 " + kv.second.name);
|
||
EXPECT_GT(kv.second.ok, 0)
|
||
<< "格式 " << kv.second.name << " 全部导入失败,共 "
|
||
<< kv.second.total << " 个文件";
|
||
}
|
||
}
|
||
}
|
||
|
||
TEST(ModelCorpus, FormatDetection) {
|
||
std::vector<std::string> files;
|
||
collect_files(TEST_MODEL_DIR, files);
|
||
int checked = 0;
|
||
for (const auto& f : files) {
|
||
auto ext = extension_lower(f);
|
||
if (ext != ".step" && ext != ".stp" && ext != ".p21" &&
|
||
ext != ".igs" && ext != ".iges") continue;
|
||
++checked;
|
||
auto fmt = detect_format(f);
|
||
if (ext == ".step" || ext == ".stp" || ext == ".p21") {
|
||
EXPECT_EQ(fmt, CadFormat::STEP) << f;
|
||
} else {
|
||
EXPECT_EQ(fmt, CadFormat::IGES) << f;
|
||
}
|
||
}
|
||
std::cerr << "[corpus] format detection checked " << checked << " files" << std::endl;
|
||
}
|
||
|
||
// ═══════════════════════════════════════════════════════════
|
||
// G1: 真实工业模型库三率报告(realfile)
|
||
// ═══════════════════════════════════════════════════════════
|
||
|
||
TEST(ModelCorpus, RealFileThreeRates) {
|
||
std::vector<std::string> files;
|
||
collect_files(TEST_REALFILE_DIR, files);
|
||
if (files.empty()) {
|
||
GTEST_SKIP() << "realfile 模型库为空(" << TEST_REALFILE_DIR
|
||
<< "),请添加真实模型后重试";
|
||
}
|
||
int total = 0, imported = 0, healed = 0, validated = 0, skipped_large = 0, skipped_budget = 0;
|
||
std::vector<std::string> fail_import, fail_heal, fail_valid, too_large;
|
||
auto t_start = std::chrono::steady_clock::now();
|
||
double elapsed_sec = 0.0;
|
||
for (const auto& f : files) {
|
||
auto ext = extension_lower(f);
|
||
if (!is_known_format(ext)) continue; // README / DWG 等未接入格式
|
||
|
||
// 全局时间预算:超时提前结束,防止 CI 卡死
|
||
elapsed_sec = std::chrono::duration<double>(std::chrono::steady_clock::now() - t_start).count();
|
||
if (elapsed_sec > kRealfileBudgetSec) {
|
||
++skipped_budget;
|
||
continue;
|
||
}
|
||
// 大小过滤:真实装配体普遍 >5MB,超出部分跳过(不参与三率)
|
||
long long sz = file_size_bytes(f);
|
||
if (sz > static_cast<long long>(kRealfileMaxMB * 1024 * 1024)) {
|
||
++skipped_large;
|
||
too_large.push_back(f);
|
||
continue;
|
||
}
|
||
|
||
++total;
|
||
bool h = false, v = false;
|
||
try {
|
||
bool ok = import_heal_validate(f, ext, h, v);
|
||
if (ok) {
|
||
++imported;
|
||
if (h) ++healed; else fail_heal.push_back(f);
|
||
if (v) ++validated; else fail_valid.push_back(f);
|
||
} else {
|
||
fail_import.push_back(f);
|
||
}
|
||
} catch (const std::exception& e) {
|
||
fail_import.push_back(f + " (" + e.what() + ")");
|
||
} catch (...) {
|
||
fail_import.push_back(f + " (unknown exception)");
|
||
}
|
||
}
|
||
std::cerr << "[realfile] total=" << total
|
||
<< " 导入率 " << imported << "/" << total
|
||
<< " 修复率 " << healed << "/" << imported
|
||
<< " 验证率 " << validated << "/" << imported
|
||
<< " (跳过 " << skipped_large << " 个大文件, "
|
||
<< skipped_budget << " 个超预算)" << "\n";
|
||
const size_t kMaxList = 30;
|
||
size_t shown = 0;
|
||
for (const auto& s : fail_import) {
|
||
if (shown >= kMaxList) break;
|
||
std::cerr << " [import] " << s << "\n";
|
||
++shown;
|
||
}
|
||
if (fail_import.size() > shown)
|
||
std::cerr << " ... 另有 " << (fail_import.size() - shown)
|
||
<< " 个导入失败未列出\n";
|
||
shown = 0;
|
||
for (const auto& s : fail_heal) {
|
||
if (shown >= kMaxList) break;
|
||
std::cerr << " [heal] " << s << "\n";
|
||
++shown;
|
||
}
|
||
shown = 0;
|
||
for (const auto& s : fail_valid) {
|
||
if (shown >= kMaxList) break;
|
||
std::cerr << " [valid] " << s << "\n";
|
||
++shown;
|
||
}
|
||
if (skipped_large > 0) {
|
||
std::cerr << " [too_large] 共 " << skipped_large << " 个文件 > "
|
||
<< kRealfileMaxMB << "MB 未纳入统计,示例:" << "\n";
|
||
shown = 0;
|
||
for (const auto& s : too_large) {
|
||
if (shown >= 10) break;
|
||
std::cerr << " " << s << "\n";
|
||
++shown;
|
||
}
|
||
}
|
||
if (skipped_budget > 0) {
|
||
std::cerr << " [budget] 达到全局时间预算,提前结束,剩余 "
|
||
<< skipped_budget << " 个文件未处理\n";
|
||
}
|
||
if (total > 0) {
|
||
EXPECT_GT(imported, 0) << "realfile 所有真实模型均导入失败";
|
||
}
|
||
}
|
||
|
||
// ═══════════════════════════════════════════════════════════
|
||
// H1: 真实模型 corner_blend 通过率基准(M5/M6 语料验收)
|
||
// 对 realfile 每个 ≤5MB STEP 模型导入+修复后,抽样若干条边做
|
||
// corner_blend(半径 ∝ 模型尺度),统计边级/模型级通过率并输出。
|
||
// "通过" = 产物面数增加(未回退原体)且 validate() 拓扑有效。
|
||
// 首次运行记录基线(打印到 stderr);断言仅要求至少 1 条边成功,
|
||
// 避免因真实几何退化(孔/多环面/非流形)而脆断。
|
||
// ═══════════════════════════════════════════════════════════
|
||
|
||
TEST(ModelCorpus, RealFileCornerBlendPassRate) {
|
||
const int kMaxEdgesPerModel = 6; // 每模型抽样边数
|
||
const int kMaxFacesPerModel = 1500; // 大面数模型 blend 全量复制过慢,跳过
|
||
// 语料:realfile(用户交付,全量)+ corpus/real(M5/M6 3800+,抽样 40)
|
||
const struct { const char* dir; int max_models; } kDirs[] = {
|
||
{TEST_REALFILE_DIR, 100000},
|
||
{TEST_REAL_CORPUS_DIR, 40},
|
||
};
|
||
int models = 0, models_ok = 0;
|
||
int edges_total = 0, edges_ok = 0, edges_wt = 0;
|
||
int skipped_large = 0, skipped_budget = 0, skipped_faces = 0;
|
||
std::vector<std::string> fail_models;
|
||
auto t_start = std::chrono::steady_clock::now();
|
||
double elapsed_sec = 0.0;
|
||
|
||
for (const auto& d : kDirs) {
|
||
std::vector<std::string> files;
|
||
collect_files(d.dir, files);
|
||
int processed = 0;
|
||
for (const auto& f : files) {
|
||
auto ext = extension_lower(f);
|
||
if (ext != ".step" && ext != ".stp" && ext != ".p21") continue;
|
||
if (processed >= d.max_models) break;
|
||
++processed;
|
||
|
||
elapsed_sec = std::chrono::duration<double>(
|
||
std::chrono::steady_clock::now() - t_start).count();
|
||
if (elapsed_sec > kRealfileBudgetSec) { ++skipped_budget; continue; }
|
||
long long sz = file_size_bytes(f);
|
||
if (sz > static_cast<long long>(kRealfileMaxMB * 1024 * 1024)) {
|
||
++skipped_large; continue;
|
||
}
|
||
|
||
std::vector<BrepModel> imported;
|
||
try { imported = import_step(f); } catch (...) { continue; }
|
||
if (imported.empty()) continue;
|
||
|
||
std::vector<BrepModel> mset;
|
||
for (auto& m0 : imported) {
|
||
BrepModel m = m0;
|
||
try { (void)automatic_heal(m); } catch (...) { continue; }
|
||
if (static_cast<int>(m.num_faces()) > kMaxFacesPerModel) {
|
||
++skipped_faces; continue;
|
||
}
|
||
mset.push_back(std::move(m));
|
||
}
|
||
if (mset.empty()) continue;
|
||
++models;
|
||
bool model_ok = false;
|
||
for (auto& m : mset) {
|
||
if (m.num_edges() < 3) continue;
|
||
auto bb = m.bounds();
|
||
double scale = (bb.max() - bb.min()).norm();
|
||
if (!(scale > 1e-6)) continue;
|
||
double r = 0.01 * scale;
|
||
if (r > 0.5) r = 0.5; // 上限防大半径自交
|
||
|
||
int ne = static_cast<int>(m.num_edges());
|
||
int step = std::max(1, ne / kMaxEdgesPerModel);
|
||
for (int ei = 0; ei < ne && ei / step < kMaxEdgesPerModel; ei += step) {
|
||
++edges_total;
|
||
BrepModel res;
|
||
try {
|
||
res = corner_blend(m, {ei}, r);
|
||
} catch (...) { continue; }
|
||
if (res.num_faces() <= m.num_faces()) continue; // 回退原体
|
||
auto vr = validate(res);
|
||
if (!vr.valid) continue;
|
||
++edges_ok;
|
||
if (vr.watertightness > 0.99) ++edges_wt;
|
||
model_ok = true;
|
||
}
|
||
}
|
||
if (model_ok) ++models_ok; else fail_models.push_back(f);
|
||
}
|
||
}
|
||
std::cerr << "[realfile corner_blend] 模型级 " << models_ok << "/" << models
|
||
<< " 边级 " << edges_ok << "/" << edges_total
|
||
<< " 边级水密(>0.99) " << edges_wt << "/" << edges_total
|
||
<< " (跳过 " << skipped_large << " 个大文件, "
|
||
<< skipped_faces << " 个高面数, " << skipped_budget << " 个超预算)\n";
|
||
const size_t kMaxList = 30;
|
||
size_t shown = 0;
|
||
for (const auto& s : fail_models) {
|
||
if (shown >= kMaxList) break;
|
||
std::cerr << " [no edge] " << s << "\n";
|
||
++shown;
|
||
}
|
||
if (fail_models.size() > shown)
|
||
std::cerr << " ... 另有 " << (fail_models.size() - shown)
|
||
<< " 个模型无成功边未列出\n";
|
||
if (edges_total > 0) {
|
||
EXPECT_GT(edges_ok, 0)
|
||
<< "corner_blend 对真实模型全部回退原体(通过率为 0,需排查)";
|
||
}
|
||
}
|