step-examples/12-2a-pcurves/Gp173.stp
Sources
- OCCT `ShapeConstruct_ProjectCurveOnSurface` (`Perform` sampled-approximation branch + `correctExtremity`)
- B4 wave-12 repair-code mining (LGPL-clean — pattern only, no bytes copied).
Sender
STEP translators that emit an `EDGE_CURVE` with a general free-form 3D B-spline lying on a curved analytic surface (sphere/torus) but supply only a crude straight-line placeholder pcurve (or none), leaving the receiver to build the true 2D image by projection.
Description
An `EDGE_CURVE` (`#24`) has a 3D geometry that is a general, non-iso, cubic `B_SPLINE_CURVE_WITH_KNOTS` (`#11`, control points near but not on a radius-5 `SPHERICAL_SURFACE` `#5`) tracing a diagonal path from `(5,0,0)` toward the north pole. There is no closed-form analytic projection of a general B-spline onto a sphere, so `ShapeConstruct_ProjectCurveOnSurface` cannot use its analytic path and falls back to the **sampled** branch: it evaluates the 3D curve at a fixed grid of sample points (~23), projects each onto the sphere, and approximates a B-spline pcurve through the projected 2D points. The approximated pcurve's endpoints do not land exactly on the vertex UV parameters, so `correctExtremity` must nudge the projected 2D endpoints back onto the vertices. Two additional stressors are baked in: the supplied pcurve (`#22`) is a crude straight 2D `LINE` that does not match the true projection, and the terminal `VERTEX_POINT` (`#13`, `(0.02,0.48,4.98)`) is offset ~0.02 mm from the 3D curve endpoint, forcing a real (non-zero) endpoint residual. OCCT loads the shape (`shape(1)`) after running the sampled projection and adding the sphere's natural bounds (seam + pole degenerate edges), so the single declared edge becomes a 5-edge, 10-vertex healed face.
Reproducer recipe
`SPHERICAL_SURFACE` radius 5; an `ADVANCED_FACE` whose outer bound is one `EDGE_CURVE` whose 3D curve is a cubic `B_SPLINE_CURVE_WITH_KNOTS` running diagonally across the sphere (no analytic pcurve exists); attach a `SURFACE_CURVE` with a single straight-`LINE` placeholder `PCURVE` on the sphere, and offset one endpoint vertex ~0.02 mm off the 3D curve end. OCCT: `shape(1)`, sampled projection + `correctExtremity` run at load; gmsh: reject.
Expected kernel behavior
detect that no analytic projection exists, sample the 3D curve, approximate the pcurve, and snap the projected extremities to the vertex parameters within tolerance; or reject the edge if the sampled approximation exceeds the edge tolerance. The residual endpoint gap must be closed by re-projecting the vertices, not left as a `SameParameter` violation.
Notes
OCCT `ShapeConstruct_ProjectCurveOnSurface` sampled-fallback + `correctExtremity`. B4 wave-12 repair-code mining. **See also**: Gp005 (apex-projection singularity), Gp008 (oscillating projected pcurve), Gp072 (`FixAddPCurve` planar projection). Distinct from those: this is the **sampled-approximation** path taken when analytic projection is unavailable on a curved surface, plus the endpoint-extremity correction sub-step. Provenance tier: runtime-only — the bytes encode only the trigger geometry (non-analytic 3D B-spline + placeholder pcurve + offset vertex); whether the projector uses the sampled branch and how `correctExtremity` nudges the endpoints manifests only at kernel runtime. Mutation-test verified oracle-invisible: removing the endpoint offset leaves the summary and tier-3 counts unchanged (`occt=shape(1)`, faces=1, edges=5, verts=10) because OCCT heals to the same shape either way. Synonyms: "B-spline pcurve approximated from sample points", "analytic pcurve projection unavailable on sphere", "sampled projection fallback for free-form edge", "projected pcurve endpoints corrected to vertex parameters", "correctExtremity nudges pcurve endpoint", "23-point sampled pcurve approximation", "non-analytic 3D curve projected onto spherical surface".
Expected validation
occt=shape(1)/shape(1) gmsh=reject ifc=schema_n/a
Provenance tier
runtime-only — defect not fully embodied in fixture bytes.
Byte assertions
contains(b'SPHERICAL_SURFACE')contains(b'B_SPLINE_CURVE_WITH_KNOTS')contains(b'SURFACE_CURVE')contains(b'EDGE_CURVE')count_entity_def(b'PCURVE') >= 1
Tier-3 assertions
shape_null == Falsen_faces_total == 1n_edges_total == 5n_vertices_total == 10face[0].surface_type == "sphere"
Cross-references
Live oracle output
No live oracle data — run _run_corpus to populate.
Fixture content
Show fixture bytes (with defect highlighting)
1ISO-10303-21; 2/* Gp173: EDGE_CURVE whose 3D geometry is a general (non-iso, non-analytic) cubic B_SPLINE_CURVE_WITH_KNOTS lying approximately on a SPHERICAL_SURFACE (radius 5). No closed-form analytic projection of a general B-spline onto a sphere exists, so ShapeConstruct_ProjectCurveOnSurface must fall back to its sampled path: it evaluates ~23 sample points, approximates a B-spline pcurve through them, then runs correctExtremity to nudge the projected 2D endpoints onto the vertex parameters. The supplied pcurve is a crude straight 2D LINE placeholder that does not match the true projection, and the end VERTEX_POINT is offset ~0.02mm from the 3D curve end, so a residual endpoint gap must be corrected. Input pattern: 3D curve not analytically projectable onto host surface + missing/placeholder pcurve + endpoint residual â exercises the sampled-fallback + correctExtremity repair path. B4 wave-12 repair-code mining (ShapeConstruct_ProjectCurveOnSurface). SHELL_BASED_SURFACE_MODEL is model entity */ 3HEADER; 4FILE_DESCRIPTION(('Gp173'),'2;1'); 5FILE_NAME('Gp173.stp','2026-07-06T00:00:00',(''),(''),'cad-research-suite','',''); 6FILE_SCHEMA(('AUTOMOTIVE_DESIGN { 1 0 10303 214 3 1 1 }')); 7ENDSEC; 8DATA; 9#9000=APPLICATION_CONTEXT('mechanical design'); 10#1=CARTESIAN_POINT('sphere_center',(0.0,0.0,0.0)); 11#2=DIRECTION('',(0.0,0.0,1.0)); 12#3=DIRECTION('',(1.0,0.0,0.0)); 13#4=AXIS2_PLACEMENT_3D('',#1,#2,#3); 14#5=SPHERICAL_SURFACE('sph',#4,5.0); 15#6=CARTESIAN_POINT('bsp_p0',(5.0,0.0,0.0)); 16#7=CARTESIAN_POINT('bsp_p1',(4.0,2.0,1.5)); 17#8=CARTESIAN_POINT('bsp_p2',(2.5,2.5,3.0)); 18#9=CARTESIAN_POINT('bsp_p3',(1.0,2.0,4.3)); 19#10=CARTESIAN_POINT('bsp_p4',(0.0,0.5,4.98)); 20#11=B_SPLINE_CURVE_WITH_KNOTS('crv3d',3,(#6,#7,#8,#9,#10),.UNSPECIFIED.,.F.,.F.,(4,1,4),(0.0,0.5,1.0),.UNSPECIFIED.); 21#12=CARTESIAN_POINT('v_start',(5.0,0.0,0.0)); 22#13=CARTESIAN_POINT('v_end_offset',(0.02,0.48,4.98)); 23#14=VERTEX_POINT('',#12); 24#15=VERTEX_POINT('',#13); 25#16=CARTESIAN_POINT('pc_placeholder_p0',(0.0,0.0)); 26#17=DIRECTION('',(0.7071067811865476,0.7071067811865476)); 27#18=VECTOR('',#17,2.221441469079183); 28#19=LINE('pc_crude',#16,#18); 29#20=(GEOMETRIC_REPRESENTATION_CONTEXT(2)PARAMETRIC_REPRESENTATION_CONTEXT()REPRESENTATION_CONTEXT('','2D')); 30#21=DEFINITIONAL_REPRESENTATION('',(#19),#20); 31#22=PCURVE('pc_on_sphere',#5,#21); 32#23=SURFACE_CURVE('sc_bsp',#11,(#22),.PCURVE_S1.); 33#24=EDGE_CURVE('ec_bsp',#14,#15,#23,.T.); 34#25=ORIENTED_EDGE('',$,$,#24,.T.); 35#26=EDGE_LOOP('',(#25)); 36#27=FACE_OUTER_BOUND('',#26,.T.); 37#28=ADVANCED_FACE('',(#27),#5,.T.); 38#29=OPEN_SHELL('',(#28)); 39#30=SHELL_BASED_SURFACE_MODEL('',(#29)); 40#9050=PRODUCT_CONTEXT('',#9000,'mechanical'); 41#9051=PRODUCT('Gp173','Gp173','',(#9050)); 42#9052=PRODUCT_DEFINITION_FORMATION('','',#9051); 43#9053=PRODUCT_DEFINITION_CONTEXT('part definition',#9000,'design'); 44#9054=PRODUCT_DEFINITION('','','',#9052,#9053); 45#9055=PRODUCT_DEFINITION_SHAPE('','','',#9054); 46#9056=(LENGTH_UNIT()NAMED_UNIT(*)SI_UNIT(.MILLI.,.METRE.)); 47#9057=(NAMED_UNIT(*)PLANE_ANGLE_UNIT()SI_UNIT($,.RADIAN.)); 48#9058=(NAMED_UNIT(*)SI_UNIT($,.STERADIAN.)SOLID_ANGLE_UNIT()); 49#9059=UNCERTAINTY_MEASURE_WITH_UNIT(LENGTH_MEASURE(1.0E-7),#9056,'distance_accuracy_value',''); 50#9060=(GEOMETRIC_REPRESENTATION_CONTEXT(3)GLOBAL_UNCERTAINTY_ASSIGNED_CONTEXT((#9059))GLOBAL_UNIT_ASSIGNED_CONTEXT((#9056,#9057,#9058))REPRESENTATION_CONTEXT('','3D')); 51#9061=MANIFOLD_SURFACE_SHAPE_REPRESENTATION('',(#30),#9060); 52#9062=SHAPE_DEFINITION_REPRESENTATION(#9055,#9061); 53ENDSEC; 54END-ISO-10303-21;