Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion crates/smlib/src/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,6 @@ pub(crate) fn fixes() -> UpstreamFixes {
f.mirror_curve_keeps_euclidean_control_points = true;
f.fillet_corner_variable_radius_rail_on_opposite_fillet = true;
f.dupin_bottom_hyperbola_axis = true;
f.extent3d_contains_both_segment_endpoints = true;
f.twist_simple_duw_sign = true;
f.offset_swap_uv_extended_distance = true;
f.validation_does_not_make_uv_trims = true;
Expand Down
192 changes: 96 additions & 96 deletions solidcore/crates/goldens/expected/surface.b_spline_volume.jsonl

Large diffs are not rendered by default.

46 changes: 23 additions & 23 deletions solidcore/crates/goldens/expected/surface.volume_p2.jsonl

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ use solidcore::geom::extent3d::Extent3d;
use solidcore::geom::pseudo_box::PseudoBox;
use solidcore::geom::transform::Transform;
use solidcore::geom::vector3d::Vec3;
use solidcore::kernel::Kernel;
use solidcore::nurbs::math::CPoint;
use solidcore::nurbs::spiral::allocate_nurb_volume;
use solidcore::surface::b_spline_volume::{BSplineVolume, VolumeParam, VolumeParams};
Expand Down Expand Up @@ -468,7 +467,7 @@ fn rust(i: &Inputs) -> Result<Output, HarnessError> {
} => {
let v = build(vol)?;
let in_pt = tri!(o, v.is_point_in_param_domain_simple(v3(*p)));
let in_line = tri!(o, v.is_line_in_param_domain_simple(&Kernel::default(), v3(*a), v3(*e)));
let in_line = tri!(o, v.is_line_in_param_domain_simple(v3(*a), v3(*e)));
let pbox = Extent3d::from_points(v3(*a), v3(*e));
let mut trim = Extent3d::from_points(v3(*c), v3(*d));
let r = v.trim_param_bounding_box_simple(&pbox, &mut trim);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ fn rust(i: &Inputs) -> Result<Output, HarnessError> {
Inputs::Preds { p, a, b, .. } => {
let v = need()?;
let in_point = tri!(o, v.is_point_in_param_domain_simple(v3(*p)));
let in_line = tri!(o, v.is_line_in_param_domain_simple(&Kernel::default(), v3(*a), v3(*b)));
let in_line = tri!(o, v.is_line_in_param_domain_simple(v3(*a), v3(*b)));
let bounded = tri!(o, v.is_bounded_simple());
o.push(0.0);
o.extend([fl(in_point), fl(in_line), fl(bounded)]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ fn rust(i: &Inputs) -> Result<Output, HarnessError> {
let v = need()?;
let line = Curve::from(Line::from_points(v3(*a), v3(*b), 3));
let in_point = tri!(o, v.is_point_in_param_domain_simple(v3(*p)));
let in_line = tri!(o, v.is_line_in_param_domain_simple(&Kernel::default(), v3(*a), v3(*b)));
let in_line = tri!(o, v.is_line_in_param_domain_simple(v3(*a), v3(*b)));
let in_curve = tri!(o, v.is_curve_in_param_domain_simple(&Kernel::default(), &line));
let bounded = tri!(o, v.is_bounded_simple());
o.push(0.0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ fn rust(k: &Kernel, i: &Inputs) -> Result<Output, HarnessError> {
Inputs::Preds { p, a, b, .. } => {
let v = need()?;
let in_point = tri!(o, v.is_point_in_param_domain_simple(v3(*p)));
let in_line = tri!(o, v.is_line_in_param_domain_simple(k, v3(*a), v3(*b)));
let in_line = tri!(o, v.is_line_in_param_domain_simple(v3(*a), v3(*b)));
let bounded = tri!(o, v.is_bounded_simple());
o.push(0.0);
o.extend([fl(in_point), fl(in_line), fl(bounded)]);
Expand Down
2 changes: 1 addition & 1 deletion solidcore/crates/goldens/src/units/surface_volume_p1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,7 @@ fn rust(k: &Kernel, i: &Inputs) -> Result<Output, HarnessError> {
}
Inputs::SimplePreds { p, a, b: e, .. } => {
let pt = tri!(o, v.is_point_in_param_domain_simple(v3(*p)));
let ln = tri!(o, v.is_line_in_param_domain_simple(k, v3(*a), v3(*e)));
let ln = tri!(o, v.is_line_in_param_domain_simple(v3(*a), v3(*e)));
let cv = tri!(o, v.is_curve_in_param_domain_simple(&Kernel::default(), &line(*a, *e)));
o.extend([0.0, b(pt), b(ln), b(cv)]);
}
Expand Down
3 changes: 0 additions & 3 deletions solidcore/crates/solidcore/src/kernel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -603,9 +603,6 @@ pub struct UpstreamFixes {
pub drop_curve_v_domain_degeneracy: bool,
/// `SmTorus::AssertValid` reports a spindle torus whose V interval runs through an apex (`V = ±(90 + asin(R/r))`) as test 5, "Self Intersection", where upstream clears its result with no report and tests the U interval against `90 + acos(R/r)`, failing every spindle torus with a whole turn of U (WR-539; the fork's tangency-labs/smlib@daba678).
pub torus_check_spindle_apex: bool,
/// Volume line-domain checks using `SmExtent3d::ContainsLineSeg3d` require
/// both endpoints inside the natural parameter box instead of either (WR-3).
pub extent3d_contains_both_segment_endpoints: bool,
/// `SmSurface::LocalSurfaceIntersect`'s out-of-bounds boundary retries guard both
/// the minimum and maximum boundary tests of the second through fourth parameter
/// branches (`v` of `this`, `u` of `other`, `v` of `other`) with `!bFoundSolution`,
Expand Down
27 changes: 10 additions & 17 deletions solidcore/crates/solidcore/src/surface/volume/p1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@
//!
//! Deviations:
//! - **WR-3.** The bounded rectilinear line-domain check requires both endpoints
//! with `Kernel::fixes.extent3d_contains_both_segment_endpoints`; default is upstream OR.
//! inside the box, so the whole segment is inside (upstream's `ContainsLineSeg3d`
//! accepts either end).
//! - **Nesting.** `with_maps` and `add_next_map` return `InvalidInput` when the next-map chain would nest
//! deeper than [`MAX_GEOMETRY_NESTING`]
//! (32; upstream fixtures nest at most 3), which bounds the recursive dispatch,
Expand Down Expand Up @@ -809,7 +810,7 @@ impl Volume {
with_compounding: bool,
) -> Result<bool> {
// pass the call along
let mut is_in = self.is_line_in_param_domain_simple(k, start, end)?;
let mut is_in = self.is_line_in_param_domain_simple(start, end)?;

// when asked - check compounded volumes as well
if let (true, true, Some(next)) = (is_in, with_compounding, self.next_map.as_deref()) {
Expand Down Expand Up @@ -1387,32 +1388,24 @@ impl Volume {
}
}

/// Whether the parameter segment is in the natural domain (always, unbounded;
/// upstream's `ContainsLineSeg3d` tests either end) (`IsLineInParamDomainSimple`,
/// virtual). With `extent3d_contains_both_segment_endpoints` (WR-3), bounded
/// rectilinear domains require both endpoints inside instead.
/// Whether the parameter segment is in the natural domain
/// (`IsLineInParamDomainSimple`, virtual): always for an unbounded domain; a
/// bounded rectilinear domain needs both endpoints inside, which for a box (a
/// convex set) is exactly the whole segment inside (WR-3: upstream's
/// `ContainsLineSeg3d` accepts either end).
///
/// # Errors
///
/// [`SolidError::Unported`] for the unported kinds.
pub fn is_line_in_param_domain_simple(
&self,
k: &Kernel,
start: Point3,
end: Point3,
) -> Result<bool> {
pub fn is_line_in_param_domain_simple(&self, start: Point3, end: Point3) -> Result<bool> {
match &self.kind {
VolumeKind::Twist(t) => Ok(t.is_line_in_param_domain_simple()),
VolumeKind::Unbend(u) => Ok(u.is_line_in_param_domain_simple(start, end)),
VolumeKind::Bend(b) => Ok(b.is_line_in_param_domain_simple(start, end)),
_ => {
if self.is_bounded_simple()? {
let domain = self.natural_param_domain()?;
return Ok(if k.fixes.extent3d_contains_both_segment_endpoints {
domain.contains_point(start, 0.0) && domain.contains_point(end, 0.0)
} else {
domain.contains_line_seg(start, end, 0.0)
});
return Ok(domain.contains_point(start, 0.0) && domain.contains_point(end, 0.0));
}
Ok(true)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ const SOLIDCRAFT_C494A18: &[&str] = &[
"edgeuse_convexity_propagates_step_off_failure",
"ellipse_step_interval_checks",
"ellipse_trim_seam_lines_span_cone_height",
"extent3d_contains_both_segment_endpoints",
"extrusion_origin_scaled_zero",
"face_points_span_domain",
"face_tight_box_searches_trim",
Expand Down
1 change: 0 additions & 1 deletion solidcore/crates/solidcore/tests/kernel_cases/fixes.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
"volume_lift_third_derivative_terms",
"drop_curve_v_domain_degeneracy",
"torus_check_spindle_apex",
"extent3d_contains_both_segment_endpoints",
"local_surface_intersect_guards_max_boundary_retry",
"cylinder_rebuild_mean_radius",
"nurb_cylinder_inside_out_frame",
Expand Down
72 changes: 33 additions & 39 deletions solidcore/crates/solidcore/tests/wr3_segment_box_containment.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//! WR-3: the volume domain checks honor opt-in segment containment.
//! WR-3: a bounded volume's domain checks contain a segment only when both ends
//! are in the parameter box (a box is convex, so that is the whole segment).

use solidcore::{
geom::extent3d::Extent3d,
Expand All @@ -12,7 +13,7 @@ use solidcore::{
};

#[test]
fn one_endpoint_inside_is_contained_only_in_legacy_mode() {
fn one_endpoint_inside_is_not_contained() {
let mut nurb = allocate_nurb_volume([1; 3], [1; 3], [3; 3]).unwrap();
for d in 0..3 {
nurb.knots_mut(d).copy_from_slice(&[0.0, 0.0, 1.0, 1.0]);
Expand All @@ -23,42 +24,35 @@ fn one_endpoint_inside_is_contained_only_in_legacy_mode() {
let volume = Volume::new(VolumeKind::BSpline(BSplineVolume::new(nurb)));
let inside = Vec3::new(0.5, 0.5, 0.5);
let outside = Vec3::new(2.0, 0.5, 0.5);
let mut kernel = Kernel::default();
assert!(!kernel.fixes.extent3d_contains_both_segment_endpoints);
for fixed in [false, true] {
kernel.fixes.extent3d_contains_both_segment_endpoints = fixed;
for (start, end, expected) in [
(inside, outside, !fixed),
(outside, inside, !fixed),
(Vec3::ZERO, Vec3::new(1.0, 1.0, 1.0), true),
(outside, outside, false),
(Vec3::new(-1.0, 0.5, 0.5), outside, false),
] {
assert_eq!(
volume
.is_line_in_param_domain_simple(&kernel, start, end)
.unwrap(),
expected,
);
assert_eq!(
volume
.is_line_in_param_domain(&kernel, start, end, false)
.unwrap(),
expected,
);
// Also exercise the in-space entry point and compounding option.
assert_eq!(
volume
.is_line_in_in_space_domain(&kernel, start, end, true)
.unwrap(),
(expected, start, end),
);
}
// Box checks also traverse this path, but their outside face has edges
// with both ends outside, so even legacy mode rejects this box.
let partial_box = Extent3d::from_points(inside, outside);
assert!(!volume
.is_box_in_param_domain(&kernel, &partial_box, false)
.unwrap());
let kernel = Kernel::default();
for (start, end, expected) in [
(inside, outside, false),
(outside, inside, false),
(Vec3::ZERO, Vec3::new(1.0, 1.0, 1.0), true),
(outside, outside, false),
(Vec3::new(-1.0, 0.5, 0.5), outside, false),
] {
assert_eq!(
volume.is_line_in_param_domain_simple(start, end).unwrap(),
expected,
);
assert_eq!(
volume
.is_line_in_param_domain(&kernel, start, end, false)
.unwrap(),
expected,
);
// Also exercise the in-space entry point and compounding option.
assert_eq!(
volume
.is_line_in_in_space_domain(&kernel, start, end, true)
.unwrap(),
(expected, start, end),
);
}
// Box checks also traverse this path; the box reaches outside the domain.
let partial_box = Extent3d::from_points(inside, outside);
assert!(!volume
.is_box_in_param_domain(&kernel, &partial_box, false)
.unwrap());
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Updates: WR-3

#### WR-3 (update, 2026-11-14). `extent3d_contains_both_segment_endpoints` is removed; both ends are the only test

`Volume::is_line_in_param_domain_simple` (`surface/volume/p1.rs`) always requires both segment ends inside the
natural parameter box of a bounded rectilinear domain (B-spline volumes). A box is convex, so that holds exactly when
the whole segment is inside. The flag is gone, so the 2026-10-31 addendum's opt-in no longer exists. Removed: the
field, SolidCraft's preset line, its entries in the kernel rig's `fixes.json` and in
`issue_2260_gn_pipe_refined_range_end.rs`, and the flag-off branch. The function no longer takes the kernel.
`Extent3d::contains_line_seg` keeps upstream's either-end result for its own callers (none in production).

- **Defaults:** SolidCraft's preset had the flag on, so the app's results don't change. `Kernel::default()` changes:
a segment with one end outside the box is no longer in the domain.
- **Goldens:** 119 rows move, each a line-in-domain answer from 1 to 0: `surface.b_spline_volume` preds (96, `in_line`)
and `surface.volume_p2` line_in_in_space (23; the first map is a B-spline with no orient map, so the AND over the
chain is 0). In each, one end lies outside the first-to-last-knot box and the other inside. The smallest margin is
1e-7 (z = 1.0000001 against a box ending at 1). No other row of any unit moves.
- **Tests:** `tests/wr3_segment_box_containment.rs` runs on the default kernel. The half that pinned upstream's
either-end answer is removed; the expected values for the default (both ends) are unchanged.
- **Open:** `Extent3d::contains_point` is a negated OR of `<`/`>` tests, so a NaN coordinate counts as inside. A NaN
end therefore still passes this test, before and after this change.
Loading