fcf25e561d
v4.1 收尾: - IncrementalUpdateEngine: dirty flag propagation, cache invalidation - LargeAssembly: InstanceCache, assembly instancing - STEP import: robust/graceful parsing with skip tracking v4.3 分析工具: - Mass properties (volume, centroid, inertia tensor) - Clearance analysis, wall thickness analysis - Enhanced drawing: hidden-line removal, offset sections, BOM - DXF import (LINE/CIRCLE/ARC/LWPOLYLINE/SPLINE → B-Rep extrusion) v4.4 地基加固: - ToleranceChain: RSS cumulative tolerance propagation (7 tests) - Euler operations: MEV/KEV/MEF/KEF/KEMR/MEKR (20 tests) - Replace hardcoded tolerances with ToleranceConfig in validate - Fix incremental_update test API mismatch (15/15 pass on Linux) Docs: - v4.1-v4.4 development plans + roadmap updated - v4.4 marked complete on Linux 30 files, +3424/-210
48 lines
1.0 KiB
C++
48 lines
1.0 KiB
C++
#include "vde/brep/tolerance.h"
|
|
#include "vde/brep/brep.h"
|
|
|
|
namespace vde::brep {
|
|
|
|
// Global tolerance config
|
|
static ToleranceConfig g_global_tolerance;
|
|
|
|
const ToleranceConfig& ToleranceConfig::global() {
|
|
return g_global_tolerance;
|
|
}
|
|
|
|
void ToleranceConfig::set_global(const ToleranceConfig& cfg) {
|
|
g_global_tolerance = cfg;
|
|
}
|
|
|
|
double model_tolerance(const BrepModel& body) {
|
|
auto bb = body.bounds();
|
|
if (bb.min().x() > bb.max().x()) return 1e-6;
|
|
|
|
double extent = bb.extent().norm();
|
|
return adaptive_tolerance(extent);
|
|
}
|
|
|
|
// ── ToleranceChain ──
|
|
|
|
void ToleranceChain::push(const std::string& op_name, double tol) {
|
|
steps_.emplace_back(op_name, tol);
|
|
}
|
|
|
|
double ToleranceChain::cumulative() const {
|
|
double sum_sq = 0.0;
|
|
for (auto& [_, tol] : steps_) {
|
|
sum_sq += tol * tol;
|
|
}
|
|
return std::sqrt(sum_sq);
|
|
}
|
|
|
|
double ToleranceChain::max_step() const {
|
|
double m = 0.0;
|
|
for (auto& [_, tol] : steps_) {
|
|
m = std::max(m, tol);
|
|
}
|
|
return m;
|
|
}
|
|
|
|
} // namespace vde::brep
|