Files
bherbruck fa9d53bbf5 solidcore: eleven geom, heal, query and mass fixes become the only path (#14246 batch G1) (#15548)
Retires these UpstreamFixes flags. SolidCraft runs every one of them on, so
each fixed path becomes the only path: gap_samples_use_trimmed_spans,
gap_samples_non_bspline_v_stride, transform_aligned_bbox_image,
circle_silhouette_perspective_center,
global_solver_identical_prefers_larger_when_maximizing,
circumscribe_axis_map_by_basis, perspective_sphere_offsets,
cpoly_remove_poly_face_check_member, heal_stage3_failures_propagate,
precise_properties_body_length_scale, stitch_solid_nests_cavities.

Some library paths built their own default kernel or fixes
(Extent3d::circumscribe, Transform::evaluate_bounding_box_simple,
GlobalSolver::new, PolyBrep) and so ran these upstream defects even when the
application turned the fixes on. With the flags gone the fixed path applies
everywhere.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 01:25:43 +00:00

40 lines
1.5 KiB
Rust
Vendored

//! The fix set, taken by name: its own test binary, as the fix set is the process kernel's.
use solidcore_ops::{make_box, make_sphere, session, CheckLevel};
/// The fixes are the ones named, by `UpstreamFixes` field name; an unknown name changes nothing.
/// The kernel runs with them: with every fix on a sphere's volume is the closed form.
#[test]
fn fixes_are_taken_by_name() {
let names = solidcore::kernel::UpstreamFixes::NAMES;
let before = session::fixes();
assert!(session::set_fixes(["no_such_fix"]).is_err());
assert_eq!(session::fixes(), before);
session::set_fixes([names[0]]).unwrap();
assert_eq!(session::fixes(), vec![names[0]]);
session::set_fixes([]).unwrap();
assert!(session::fixes().is_empty());
let ball = make_sphere([0.0; 3], 2.0).unwrap();
session::set_fixes(names.iter().copied()).unwrap();
let v = ball.volume(1e-8).unwrap();
assert!((v - 32.0 / 3.0 * std::f64::consts::PI).abs() < 1e-6, "{v}");
// A transform's result is valid whatever the fix set.
for on in [&[][..], names] {
session::set_fixes(on.iter().copied()).unwrap();
let b = make_box([0.0; 3], [1.0, 2.0, 3.0]).unwrap();
let m = [
[0.0, 2.0, 0.0, 0.0],
[-1.0, 0.0, 0.0, 0.0],
[0.0, 0.0, 1.0, 0.0],
[1.0, 2.0, 3.0, 1.0],
];
b.transform(&m).unwrap();
assert!(
b.check(CheckLevel::All).unwrap().is_valid(),
"{} fixes on",
on.len()
);
}
}