mirror of
https://github.com/bherbruck/solidcraft.git
synced 2026-11-03 10:35:58 +00:00
Sheet machining: a depth an ulp off the sheet's face is on it
A hole drawn on a flange's face and cut through ("direction": "negative") was refused as
"below the supported 0.000001 mm extrusion resolution": the flange panel's frame, turned
up by the cosine and sine of 90 degrees, puts the panel's origin at -1.9999999999999998
along the sketch normal, so the cut ends 2.2e-16 mm short of the sheet's far face and
reads as a layer 2.2e-16 thick. A depth within four units in the last place of the
numbers it is worked out from (the frame origins, the tool's span and the thickness) now
lands on the face. A real thin layer stays: a 1e-8 mm layer of a sheet 1e5 mm from the
origin (bound 9e-11 there) is still refused
(partial_depth_intersect_sub_extrusion_resolution_layers_refuse_atomically passes).
Fixes sheet::tests::a_sketch_on_a_sheet_face_follows_the_sheet_when_its_thickness_changes.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1422,6 +1422,13 @@ fn sheet_prism_cut(
|
||||
}
|
||||
let (a, b) = nominal_depth.unwrap_or((a, b));
|
||||
let (z0, z1) = (a.min(b).max(0.0), a.max(b).min(sh.t));
|
||||
// A depth within a few units in the last place of the numbers it is worked out from
|
||||
// is on the face: a flange panel's frame, turned by the cosine and sine of its angle,
|
||||
// puts its faces an ulp (2e-16 mm) off the tool's cap they meet. A thinner layer is
|
||||
// the tool's own and stays (refused below when under the resolution).
|
||||
let ulps =
|
||||
4.0 * f64::EPSILON * (apply_point(&w, Vec3::ZERO).len() + plane.origin.len() + span.0.abs() + span.1.abs() + sh.t) / sign.abs();
|
||||
let (z0, z1) = (if z0 <= ulps { 0.0 } else { z0 }, if sh.t - z1 <= ulps { sh.t } else { z1 });
|
||||
// Sub-resolution layers must not be silently erased by endpoint snapping.
|
||||
let depth_resolved = ![z0, sh.t - z1, z1 - z0].into_iter().any(|d| d > 0.0 && d < 1e-6);
|
||||
labels.extend(letters.iter().filter_map(|r| sh.region_to_flat(pi, plane, r).ok()));
|
||||
|
||||
Reference in New Issue
Block a user