mirror of
https://github.com/bherbruck/solidcraft.git
synced 2026-11-03 10:35:58 +00:00
kernel: SMLib measures mass properties at its documented 1e-4
measure_backend asked SMLib for mass properties at 1e-8, the finest its
integrator allows and below the range SmApiBrepComputeMassProperties
documents ("Relative accuracy, clamped to [1e-4, 1e-1]", SmApiQueries.h,
whose cost is "governed by dRelativeAccuracy"). The tight request was there
because the documented range did not hold on faces bounded by circles
(KNOWN_ISSUES.md); the fork's dcbb07d integrates each trim-curve knot span
on its own, and such faces now meet it (a cylinder's volume 1.8e-6 off at
1e-4). At 1e-8 SMLib's measure was most of the regression rig's time on a
modelled thread (threads/602).
The measure now asks 1e-4: ten times inside the 1e-3 it is held to (AGREE
against the mesh measure, and the rig's volume and area tolerance). NURBS
spheres and tori can still miss 1e-4 by a small factor (tangency-labs/
solidcore#384; a torus's volume 2.5e-4 at 1e-4), inside that 1e-3.
Brep::mass_properties keeps MEASURE_ACCURACY (1e-8) as its tests' default.
SMLIB_REV: the fork at dcbb07d.
Not built: base in progress (kernel-smlib/no-truck 52f25ca3 does not build).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017itGh5fpMEousnZ91cYcVt
This commit is contained in:
@@ -14,6 +14,13 @@ use crate::measure::MassMeasure;
|
||||
/// centroid): SMLib must agree with it this closely for its numbers to be used.
|
||||
const AGREE: f64 = 1e-3;
|
||||
|
||||
/// The relative accuracy SMLib integrates at: the finest of SmApiBrepComputeMassProperties'
|
||||
/// documented range ("clamped to [1e-4, 1e-1]", SmApiQueries.h), ten times inside the 1e-3 the
|
||||
/// measure is held to ([`AGREE`], and the regression rig's volume and area tolerance). Its cost is
|
||||
/// "governed by dRelativeAccuracy": the finest the integrator allows, 1e-8, took tens of seconds
|
||||
/// on a modelled thread's faces.
|
||||
const ACCURACY: f64 = 1e-4;
|
||||
|
||||
/// Exact volume, area and centroid.
|
||||
pub(crate) struct Exact {
|
||||
pub volume: f64,
|
||||
@@ -31,7 +38,7 @@ pub(crate) struct Choice {
|
||||
#[cfg(feature = "smlib")]
|
||||
fn exact(b: &Body) -> Result<Exact, String> {
|
||||
let sb = crate::native::smlib_body(b).map_err(|e| e.to_string())?;
|
||||
let m = sb.mass_properties(solidcraft_smlib::MEASURE_ACCURACY).map_err(|e| format!("SMLib mass properties: {e}"))?;
|
||||
let m = sb.mass_properties(ACCURACY).map_err(|e| format!("SMLib mass properties: {e}"))?;
|
||||
let [x, y, z] = m.centroid;
|
||||
Ok(Exact { volume: m.volume, area: m.area, centroid: Vec3::new(x, y, z) })
|
||||
}
|
||||
|
||||
@@ -1 +1 @@
|
||||
f6f428bfa2588f9d163ea06dfcf05c3777d9ce57
|
||||
a6a0c024fd455adc9f98c6076806db7ea7164e2d
|
||||
|
||||
Reference in New Issue
Block a user