solidcore

Units / blend

blend.hcr green

Layer
49
Upstream lines
1,875
Functions
14
Rust module
blend::hcr

Status history

Oct 12Nov 25
  1. todo 1,875 lines
  2. partial 1,875 lines
  3. green 1,875 lines

Source: crates/solidcore/src/blend/hcr.rs

Upstream: source/SMLib/inc/SmHCR.h, source/SMLib/src/SmHCR.cpp

Port-plan notes

These notes preserve historical port measurements and limitations, not current CI results.

UB-170 safe continuation PR #1487: 476 cases, 459 passed, 17 native-guard rejections, zero failed/deferred. Exact-base 82e85 ratchet passes with 17 case-specific sentinel-accounting migration entries; full 280-unit sweep and exact-base report ratchet pass, as do optimized kernel tests, runner regressions, C++-enabled Clippy, wasm and fmt. See plan/findings/blend.hcr--ub170-safe-continuation-guard-contract.md. main CI e33985411 (2026-10-23): PARTIAL blend.hcr cases=434 passed=431 failed=0 deferred=3 blocked_by=topology.face_p2(3). EXACT SmSurfOfRevolution EXPORT (PR #304, shared graph exports carry revolution faces exactly; refreshed on main ca3bbd2b, 2026-10-21): difftest 434 cases, 393 pass, 0 failed, 41 deferred (topology.edge 30, intersect.surface_drop_lib_p3 8, surface.surface_p2 3), max_rel_err 0; 396 -> 393 pass: gen0043/gen0200/gen0245 (both sides errored before, nothing compared) now reach UNPORTED(topology.edge) SmEdge::GetVertex stubs in intersect/curve_class/p1.rs and p3.rs. Earlier: 14 fns; partial (PR #191): 434 cases (34 fixtures: hints 3/-1/big/fractional and fa >= fb / fa == fb, fixtures/blend.hcr), 394 pass, 0 fail, 40 deferred (topology.edge 27, topology.face_p3 7, surface.surface_p2 3, topology.vertex 2, intersect.surface_drop_lib_p3 1) after the maintainer merges of main with topology.brep_p1 and intersect.curve_class_p2 partial (SmCurveClassification::UpdatePointClass wired to curve_class_p2; its 35 deferrals now run: 28 pass, 7 move on to topology.edge / topology.vertex). With topology.brep_p1 alone: 366 pass, 68 deferred (GetInfiniteRegion, GetEdges, GetFaces, GetSurfaces, AddDeletedSurface wired to topology::brep::p1; the PR's m_bEditingEnabled co-port dropped for brep_p1's; the runner now sets each face surface's owner to its face as the upstream build does, without which GetSurfaces selected nothing and the 2 IsPointVisible cases failed; they now defer at surface.surface_p2 / topology.face_p3); before that merge 309 pass, 125 deferred (topology.brep_p1 67); --perturb SENSITIVE 309/309 (pre-merge); probe 3000 seeds clean (before the review round). The FFI guard accepts every int64 hint (C++: 0 none, 1 visible, other invisible) and either order of fa/fb (SmExtent1d swaps). The invisible-hint fixtures read the scene's infinite region (topology.brep_p1, wired at the merge). SmEdgeuse::EvaluateBinormal is wired to topology.edgeuse_p3 (on the scene itself, bUse3DOnly FALSE), and SmBrep::GetEdges without a filter to topology::brep::p1::edges. Of the 309 passes, 259 compare values (construction state, 1-interval classifications, single-piece ComputeEdgeVisibility, silhouette lists; status/flag records for the wire, lamina and listed early-outs) and 50 are both-errored (24 inexact_geometry, 25 rejected UB-169 guard cases, 1 rejected fixture). Classifications with 2 or more intervals: 21 generated (crossing wire-loop fixtures), all deferred: InsertPointClass splits through InsertAt / EditIntervalMin / EditIntervalMax (intersect.curve_class_p2, deferred before its merge; see the counts above); likewise the 13 multi-piece ComputeEdgeVisibility cases. The scene B-rep's SmBrep copy + Transform (topology.brep_p3) and its box (query.brep) are stubbed in Hcr::with_transform (FindAndSetInfiniteRegion is wired to topology.brep_p5 since PR #285); the runner imports the C++ scene and uses Hcr::from_scene. ComputeSilhouettes / ComputeGlobalVisibility / IsPointVisible start with topology.brep_p1 queries (only IsPointVisible is generated; it defers). SmFace::FindIfRectangularTrim is wired to topology.face_p1 (IsPointVisible's surface set; not reached while IsPointVisible defers on topology.brep_p1). CO-PORTED SmCurveClassification constructor (see intersect.curve_class_p4). Upstream defects UB-169, UB-170. hazards: ptr-hash (GetSilhouetteEdges sorted by id) Re-run after wiring stale stubs (PR #285): 434 cases, 396 pass, 0 fail, 38 deferred, max_rel_err 0. Main since: 14 fns; partial (PR #191): 434 cases (34 fixtures: hints 3/-1/big/fractional and fa >= fb / fa == fb, fixtures/blend.hcr), 394 pass, 0 fail, 40 deferred (topology.edge 27, topology.face_p3 7, surface.surface_p2 3, topology.vertex 2, intersect.surface_drop_lib_p3 1) after the maintainer merges of main with topology.brep_p1 and intersect.curve_class_p2 partial (SmCurveClassification::UpdatePointClass wired to curve_class_p2; its 35 deferrals now run: 28 pass, 7 move on to topology.edge / topology.vertex). With topology.brep_p1 alone: 366 pass, 68 deferred (GetInfiniteRegion, GetEdges, GetFaces, GetSurfaces, AddDeletedSurface wired to topology::brep::p1; the PR's m_bEditingEnabled co-port dropped for brep_p1's; the runner now sets each face surface's owner to its face as the upstream build does, without which GetSurfaces selected nothing and the 2 IsPointVisible cases failed; they now defer at surface.surface_p2 / topology.face_p3); before that merge 309 pass, 125 deferred (topology.brep_p1 67); --perturb SENSITIVE 309/309 (pre-merge); probe 3000 seeds clean (before the review round). The FFI guard accepts every int64 hint (C++: 0 none, 1 visible, other invisible) and either order of fa/fb (SmExtent1d swaps). The invisible-hint fixtures read the scene's infinite region (topology.brep_p1, wired at the merge). SmEdgeuse::EvaluateBinormal is wired to topology.edgeuse_p3 (on the scene itself, bUse3DOnly FALSE), and SmBrep::GetEdges without a filter to topology::brep::p1::edges. Of the 309 passes, 259 compare values (construction state, 1-interval classifications, single-piece ComputeEdgeVisibility, silhouette lists; status/flag records for the wire, lamina and listed early-outs) and 50 are both-errored (24 inexact_geometry, 25 rejected UB-169 guard cases, 1 rejected fixture). Classifications with 2 or more intervals: 21 generated (crossing wire-loop fixtures), all deferred: InsertPointClass splits through InsertAt / EditIntervalMin / EditIntervalMax (intersect.curve_class_p2, deferred before its merge; see the counts above); likewise the 13 multi-piece ComputeEdgeVisibility cases. The scene B-rep's SmBrep copy + Transform (topology.brep_p3) and its box (query.brep) are stubbed in Hcr::with_transform (FindAndSetInfiniteRegion is wired to topology.brep_p5 since PR #285); the runner imports the C++ scene and uses Hcr::from_scene. ComputeSilhouettes / ComputeGlobalVisibility / IsPointVisible start with topology.brep_p1 queries (only IsPointVisible is generated; it defers). SmFace::FindIfRectangularTrim is wired to topology.face_p1 (IsPointVisible's surface set; not reached while IsPointVisible defers on topology.brep_p1). CO-PORTED SmCurveClassification constructor (see intersect.curve_class_p4). Upstream defects UB-169, UB-170. hazards: ptr-hash (GetSilhouetteEdges sorted by id) Re-run after wiring stale stubs (PR #285): 434 cases, 396 pass, 0 fail, 38 deferred, max_rel_err 0. UPDATE (PR #204, topology.brep_p3): the UNPORTED(topology.brep_p3) copy constructor stub is wired to topology::brep::p3::copy_brep (no maps, bCopyAttributes and bAddAnalytics TRUE); Hcr::new and Hcr::with_transform take k: &mut Kernel, the caller's NotifyEnv and a source_key (the copy's objects under env.key_of, the source's under source_key, as api_brep_copy). The runner uses Hcr::from_scene only: report unchanged (434 cases, 394 pass, 0 fail, 40 deferred). API EXTENDED in sweep.topology_sweep (PR #222): Hcr::scene_brep_mut exposes the retained session scene for mutable topology-source borrows without cloning its identities. RE-RUN after intersect.ray_tracer wired RayTracer::add_surface_to_grid (the ray surfaces go through it): 434 cases, 396 pass, 0 fail, 38 deferred (topology.edge 37, topology.face_p2 1), max_rel_err 0; the CI report of main 03cfd79 was 386 pass, 48 deferred (surface.surface_p2 10): those 10 now run and match the C++. UPDATE 2026-10-23 (branch claude/edge-handles): blend::hcr::Geometry implements ClassGeometry::topology_entity / topology_handle for its vertex, edge and region handles, so the 37 SmEdge::GetVertex deferrals resolve (re-run after merging main with the ray-tracer change): PARTIAL blend.hcr cases=434 passed=431 failed=0 deferred=3 max_rel_err=0e0 with_values=403 no_values=28 vacuous=0 blocked_by=topology.face_p2(3). UPDATE (PR #679): Hcr::with_transform transforms the scene copy through topology::brep::p5::transform_with_notifications under the scene's notification environment. The runner builds its scenes with Hcr::from_scene, so its counts are unchanged (434 cases, 431 pass, 3 deferred). UPDATE (wire/hcr ray face caches): IsPointVisible builds each face-owned ray surface cache through its face (prepare_face_surface_cache, handle = tracer index) and classifies hits via RayFaceClassifier (SmFace::PointClassify of sm_IsPointValid): GREEN blend.hcr cases=434 passed=434 failed=0 deferred=0 max_rel_err=0e0; intersect.ray_tracer 421/421 unchanged. UPDATE (Rust-side Hcr scene, stacked on #1375): the runner's Rust side builds its own scene (B-rep block by the Rust kernel / Rust reader, the extra wire edge, Hcr::new / Hcr::with_transform with copy_brep, transform, infinite region and bounding box, renumbered into the shim's walk order) and checks seeds and op arguments against it; no C++ scene, box or ffi::validate reaches the Rust side, and no case is skipped as inexact. PARTIAL blend.hcr cases=434 passed=431 failed=0 deferred=3 with_values=403 no_values=28 blocked_by=surface.trim_srf_cache(3) (before: 434 passed): gen0103/gen0253/gen0320 (ComputeEdgeVisibility on .smb scenes) reach UNPORTED TrimSrfCache::build_tree_with_face for a face-owned surface in IsPointVisible (plan/findings/blend.hcr--own-scene-face-trim-cache-deferrals.md). WIRED (wire: surface.trim_srf_cache face-owned tree build, stacked on the Rust-side scene PR): IsPointVisible builds a face-owned surface cache through its face (smsurf_GetSurfaceCache, then AddSurfaceToGrid's two GetTree calls and ExpandHierarchy's GetTree via TrimSrfCache::get_tree_with_face, which runs SmTrimSrfCache::BuildTree with the face) before the tracer borrows the surfaces; the tracer reads that tree as is (RayTracer::add_surface_with_fetched_cache). GREEN blend.hcr cases=434 passed=434 failed=0 deferred=0 with_values=406 no_values=28 max_rel_err=0; gen0103/gen0253/gen0320 compare values again (plan/findings/blend.hcr--own-scene-face-trim-cache-deferrals--addendum-2026-10-28-wired.md). UPDATE (fix: HCR on solid bodies): SM_CAST_PTR(SmBSplineSurface) in b_spline_part also takes cones, spheres and tori (all derive from SmBSplineSurface; IsPointVisible's rectangular-trim branch reads the NURB through GetOrCreateGwNurbPointer); ComputeSilhouettes builds each face's silhouette surface cache through its face (smsurf_GetSurfaceCache + GetTree with the face) and reproduces SmTrimSrfCache::BuildTree's flag reset when the tree is built and editing is enabled (m_bProcessBoundaryCurves TRUE, m_bPointTestEnabled FALSE, m_bFaceContainmentDone restored), so a face-less GetTree no longer raises Unported. New ops global_visibility (shim op 9) and silhouettes (op 10), each C++ case in a fresh process, on the upstream solids (fixtures/blend.hcr/solid_bodies.json: Solids/cylinder, Solids/sphere, cone, torus, box_with_large_fillet; +Z, oblique and placement views; IsPointVisible on the same bodies); global_visibility outputs status -2 when a scene edge reaches UB-170 after the silhouettes of a copy of the HCR. Counts: see the PR's difftest summary.

Goldens

This is committed inventory, not a runtime result or a correctness proof. A golden records what solidcore produced when blessed. Current results require the canonical CI gate, not these counts.

Golden records
481
Stored error outcomes
32
Stored deferrals
0
Stored harness rejections
0
Known-failure entries
0

Metadata counts describe fields in the stored records; they are not passes or live failures.

Source at f9704ee3b: golden JSONL · known-failure list.

Dependencies

Depends on: curve.curve_p2 green geom.axis2_placement green geom.extent1d green geom.extent3d green geom.solution_array green geom.tol green geom.tree green geom.vector3d green intersect.curve_class_p1 green intersect.point_class green intersect.ray_tracer green surface.surface_p2 partial topology.brep_p1 green topology.edge green topology.edgeuse_p1 green topology.face_p2 partial

Soft dependencies: curve.curve_p1 green curve.curve_p5 partial curve.curve_p6 green curve.curve_p9 green geom.a_object green geom.context green geom.extent2d green geom.grid green geom.object green intersect.curve_class_p2 green intersect.curve_class_p3 green intersect.curve_class_p4 green intersect.curve_class_p7 green nurbs.b_spline_surface_n_lib_p2 green nurbs.b_spline_surface_p1 green nurbs.b_spline_surface_p2 green query.brep green surface.surface_p1 green topology.brep_p2 green topology.brep_p3 partial topology.brep_p4 green topology.brep_p5 green topology.edgeuse_p3 green topology.face_p1 green topology.face_p4 green topology.loopuse green topology.shell green topology.topology green topology.vertex green topology.vertexuse green

Dependents: audit.recursion green topology.api_projection partial

Soft dependents: none

Upstream functions

Upstream functionDefined atLinesRust (from the file header)
SmHCR::SetHCRForSilhouettesSmHCR.h:1501[Hcr::set_hcr_for_silhouettes]
SmHCR::GetSceneBrepSmHCR.h:1581[Hcr::scene_brep], [Hcr::scene_brep_mut]
SmHCR::~SmHCRSmHCR.cpp:6938Drop (implicit)
SmHCR::SmHCRSmHCR.cpp:17531[Hcr::new], [view_transform_for_vector]
SmHCR::ConstructorInitSmHCR.cpp:22770[Hcr::with_transform]
SmHCR::GetSilhouetteEdgesSmHCR.cpp:30512[Hcr::silhouette_edges]
SmHCR::ComputeCurveVisibilitySmHCR.cpp:33286[Hcr::compute_curve_visibility]
SmHCR::ComputeGlobalVisibilitySmHCR.cpp:434277[Hcr::compute_global_visibility]
SmHCR::ComputeEdgeVisibilitySmHCR.cpp:729370[Hcr::compute_edge_visibility]
SmHCR::ComputeSilhouettesSmHCR.cpp:1120305[Hcr::compute_silhouettes]
SmHCR::IsSilhouetteEdgeSmHCR.cpp:1433114[Hcr::is_silhouette_edge]
SmHCR::IsBackFacingEdgeSmHCR.cpp:165697[Hcr::is_back_facing_edge]
SmHCR::IsPointVisibleSmHCR.cpp:1766188[Hcr::is_point_visible]
SmHCR::IntersectCurveWithSilhouettesSmHCR.cpp:1962285[Hcr::intersect_curve_with_silhouettes]
Module file-header table (18 rows)
RustUpstream
[Hcr]SmHCR
[Hcr::new], [view_transform_for_vector]SmHCR::SmHCR(.., const SmVector3d&, ..)
[Hcr::with_transform]SmHCR::SmHCR(.., const SmAxis2Placement&, ..), ConstructorInit
[Hcr::from_scene]ConstructorInit after the scene B-rep is built
Drop (implicit)SmHCR::~SmHCR
[Hcr::set_hcr_for_silhouettes]SetHCRForSilhouettes
[Hcr::scene_brep], [Hcr::scene_brep_mut]GetSceneBrep
[Hcr::silhouette_edges]GetSilhouetteEdges
[Hcr::compute_curve_visibility]ComputeCurveVisibility
[Hcr::compute_global_visibility]ComputeGlobalVisibility
[Hcr::compute_edge_visibility]ComputeEdgeVisibility
[Hcr::compute_silhouettes]ComputeSilhouettes
[Hcr::add_silhouette_edge]ComputeSilhouettes, its edge classification body
[Hcr::is_silhouette_edge]IsSilhouetteEdge
[Hcr::is_back_facing_edge]IsBackFacingEdge
[Hcr::is_point_visible]IsPointVisible
[Hcr::intersect_curve_with_silhouettes]IntersectCurveWithSilhouettes
[HcrObject], Geometry (private)the SmObject* of the classifications

Upstream tests reaching this unit

SM_API_test:TestSmCreateSilhouetteCurves, prog_test:my_test_tsurface_point_extrema, prog_test:my_test_one_tess, prog_test:my_test_tsurface_tsurface_solve, prog_test:my_test_ppu, prog_test:my_sweep_null_region_counts