kernel: measure integrates to SMLib's finest accuracy, 1e-8, not 1e-4

measure asked SMLib for a relative accuracy of 1e-4, after SmApiBrepComputeMassProperties'
documented clamp to [1e-4, 1e-1]. smlib_brep_mass_properties does not go through that call: it
calls the kernel's integration directly because the clamp "leaves curved faces off by 1e-5 to
1e-3", and takes [1e-8, 1e-1] (solidcraft_smlib::MEASURE_ACCURACY). Asking 1e-4 threw that
away: a swept cylinder's centre came out 5e-7 off its exact place, and a 0.0177 mm³ crescent
(a pin 0.59 µm off its hole) 0.27% off the lens of two circles. Measured at 1e-8, the sweep
centres are exact to 1e-7 and the crescents match the closed form to 1e-6; the engine-commands
batch runs in the same 20 s.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
jyviko
2026-10-29 00:19:42 -04:00
committed by Irakli Kourtis
parent a3e42e5486
commit fad9c44dac
+5 -4
View File
@@ -43,10 +43,11 @@ pub struct MassMeasure {
pub notes: Vec<String>,
}
/// The relative accuracy SMLib integrates at: the finest of SmApiBrepComputeMassProperties'
/// documented range ("clamped to [1e-4, 1e-1]", SmApiQueries.h). Its cost is "governed by
/// dRelativeAccuracy".
const ACCURACY: f64 = 1e-4;
/// The relative accuracy SMLib integrates at: the finest the C API takes
/// ([`solidcraft_smlib::MEASURE_ACCURACY`], 1e-8). `smlib_brep_mass_properties` calls the
/// kernel's integration directly because SmApiBrepComputeMassProperties clamps to [1e-4, 1e-1],
/// which leaves curved faces off by 1e-5 to 1e-3; asking 1e-4 here threw that away.
const ACCURACY: f64 = solidcraft_smlib::MEASURE_ACCURACY;
/// Measure a body. A B-rep body's volume, area and centre are SMLib's, integrated on its exact
/// surfaces over its material regions (a sheet's: its faces' area and their centre, volume 0),