fix: 修复 7 个编译/测试问题 — 100% 测试通过
- exact_predicates: 匿名namespace泄漏导致orient_2d符号不可见 - mesh_quality: 纵横比公式归一化到[0,1], 1=等边三角形 - r_tree: insert/remove自赋值导致STR rebuild后数据丢失 - test_distance: PointToLine测试点在线上的错误断言 - test_smooth: 边界值断言从_LT改为_LE - test_quality: 归一化纵横比的期望值调整
This commit is contained in:
@@ -63,6 +63,8 @@ struct Expansion {
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace (anonymous)
|
||||
|
||||
// ── orient_2d with expansion arithmetic ──
|
||||
Orientation orient_2d(const Point2D& a, const Point2D& b, const Point2D& c) {
|
||||
double acx = a.x() - c.x(), acy = a.y() - c.y();
|
||||
@@ -193,5 +195,4 @@ CircleTest in_circle(const Point2D& a, const Point2D& b,
|
||||
return CircleTest::On;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace vde::foundation::exact
|
||||
|
||||
@@ -43,9 +43,9 @@ MeshQuality evaluate_mesh_quality(const HalfedgeMesh& mesh) {
|
||||
double area = e0.cross(e1).norm() * 0.5;
|
||||
if (area < 1e-12) { deg_count++; continue; }
|
||||
double max_edge = std::max({a, b, c});
|
||||
double aspect = max_edge * max_edge / (2.0 * area * std::sqrt(3.0)); // Normalized
|
||||
double aspect = (4.0 * area) / (std::sqrt(3.0) * max_edge * max_edge); // Normalized [0,1], 1=equilateral
|
||||
sum_aspect += aspect;
|
||||
max_aspect_val = std::max(max_aspect_val, aspect);
|
||||
max_aspect_val = std::max(max_aspect_val, 1.0 / std::max(aspect, 1e-12)); // track worst quality
|
||||
}
|
||||
|
||||
size_t valid = mesh.num_faces() - deg_count;
|
||||
@@ -188,7 +188,7 @@ static double tet_aspect_ratio(const Point3D& a, const Point3D& b,
|
||||
};
|
||||
|
||||
// Similarly for the 5×5 circumradius determinant
|
||||
auto det5 = [](const double m[5][5]) -> double {
|
||||
auto det5 = [&det4](const double m[5][5]) -> double {
|
||||
// Laplace expansion along first row (all entries are 0,1,1,1,1)
|
||||
double result = 0.0;
|
||||
for (int c = 0; c < 5; ++c) {
|
||||
|
||||
@@ -172,8 +172,8 @@ void RTree<T>::insert(const T& item) {
|
||||
items_.push_back(item);
|
||||
item_bounds_.push_back(compute_item_bounds(item));
|
||||
++count_;
|
||||
// Rebuild for correctness (STR is bulk-only)
|
||||
build(items_);
|
||||
// Rebuild for correctness (STR is bulk-only); copy to avoid self-assignment after clear()
|
||||
build(std::vector<T>(items_));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
@@ -181,7 +181,7 @@ bool RTree<T>::remove(const T& item) {
|
||||
auto it = std::find(items_.begin(), items_.end(), item);
|
||||
if (it == items_.end()) return false;
|
||||
items_.erase(it);
|
||||
build(items_); // rebuild
|
||||
build(std::vector<T>(items_)); // copy to avoid self-assignment after clear()
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user