diff --git a/ATTRIBUTION.md b/ATTRIBUTION.md index 06e54171f..aa637fe45 100644 --- a/ATTRIBUTION.md +++ b/ATTRIBUTION.md @@ -101,6 +101,8 @@ Editable drawing code, native projects and shipped exports are collected under ` | tests/step-conformance/tiny_pin.step | step-conformance contributors | generated from formulas by https://github.com/dan335/step-conformance (corpus/generated, 96f30bb); import regression fixture | CC0-1.0 | | tests/step-conformance/torus_ring_nurbs.step | step-conformance contributors | generated from formulas by https://github.com/dan335/step-conformance (corpus/generated, 96f30bb); import regression fixture | CC0-1.0 | | tests/step-conformance/washer.step | step-conformance contributors | generated from formulas by https://github.com/dan335/step-conformance (corpus/generated, 96f30bb); import regression fixture | CC0-1.0 | +| tests/ssi-corpus/cases/*.json.gz, tests/ssi-corpus/LICENSE-MIT, tests/ssi-corpus/LICENSE-APACHE | ssi-corpus contributors (jyviko) | 119 surface/surface intersection cases with exact ground truth from https://github.com/jyviko/ssi-corpus (cases/data, b04c8a6), gzip-compressed, unchanged; SSI scorer fixtures (tests/ssi-corpus/README.md) | MIT OR Apache-2.0 | +| tests/ssi-corpus/cases/y23_*.json.gz | Yang, Jia and Yan (paper authors: published surfaces, figures and topology); ssi-corpus contributors (reconstructions and truth) | 25 cases built from Yang, Jia & Yan 2023, "Topology Guaranteed B-Spline Surface/Surface Intersection", ACM Transactions on Graphics 42(6), Article 211; each cites the paper in its `source` field | CC-BY 4.0 (paper); MIT OR Apache-2.0 (case files) | | tests/step-regressions/rod_doubled_edge.step | SolidCraft contributors | written by SolidCraft from the commands of #4598 (a bored rod moved 100 mm and exported); import regression fixture | MIT OR Apache-2.0 | | tests/oracle/17-loft/reference.stl | SolidCraft contributors | triangulation of our own recipe (tests/oracle/17-loft/recipe.json) built with FreeCAD as an external tool by tools/freecad-oracle | MIT OR Apache-2.0 | | tests/oracle/23-bracket-multifeature/reference.stl | SolidCraft contributors | triangulation of our own recipe (tests/oracle/23-bracket-multifeature/recipe.json) built with FreeCAD as an external tool by tools/freecad-oracle | MIT OR Apache-2.0 | diff --git a/crates/kernel/src/native/smlib_import_tests.rs b/crates/kernel/src/native/smlib_import_tests.rs index ba67214cd..0443c3531 100644 --- a/crates/kernel/src/native/smlib_import_tests.rs +++ b/crates/kernel/src/native/smlib_import_tests.rs @@ -27,12 +27,14 @@ fn primitives_keep_their_analytic_volume() { assert!(solid && (got - 28.0 * PI).abs() <= 1e-6 * 28.0 * PI, "tilted cylinder: SMLib volume {got}, manifold {solid}"); } -/// Truck holds spheres and tori as revolutions (`PlacedRevolution`), which the SMLib import does -/// not carry yet: a clear error, never a wrong body. +/// Truck holds spheres and tori as revolutions (`PlacedRevolution`); they go to SMLib as their +/// exact rational B-spline surfaces. #[test] -fn revolutions_are_refused_for_now() { - for (name, body) in [("sphere", sphere(v(0., 0., 0.), 5.0).unwrap()), ("torus", torus(v(0., 0., 0.), 10.0, 2.0).unwrap())] { - let e = super::smlib_body(&body).err().map(|e| e.to_string()).unwrap_or_default(); - assert!(e.contains("not supported yet: revolved surfaces"), "{name}: {e}"); - } +fn revolutions_keep_their_analytic_volume() { + let (got, solid) = in_smlib(&sphere(v(1., 2., 3.), 5.0).unwrap()).unwrap(); + let ball = 4.0 / 3.0 * PI * 125.0; + assert!(solid && (got - ball).abs() <= 1e-6 * ball, "sphere: SMLib volume {got}, manifold {solid}"); + let (got, solid) = in_smlib(&torus(v(0., 0., 0.), 10.0, 2.0).unwrap()).unwrap(); + let ring = 2.0 * PI * PI * 10.0 * 4.0; + assert!(solid && (got - ring).abs() <= 1e-6 * ring, "torus: SMLib volume {got}, manifold {solid}"); } diff --git a/crates/smlib/src/import.rs b/crates/smlib/src/import.rs index 6eb65d842..c8e103949 100644 --- a/crates/smlib/src/import.rs +++ b/crates/smlib/src/import.rs @@ -276,11 +276,116 @@ fn surface(a: &mut Arrays, s: &b::Surface, domain: [[f64; 2]; 2]) -> R { a.r(flat::FACE_RANGE).extend([u0, v0, u1, v1]); return Ok(true); } - b::Surface::PlacedRevolution { .. } => return Err(Unsupported::NotYet("revolved surfaces")), + b::Surface::PlacedRevolution { profile, origin, axis, matrix, forward } => revolution(a, profile, *origin, *axis, matrix, *forward, domain)?, } Ok(false) } +/// The quarter-circle arc's rational parameter `s` in [0, 1] at angle `phi` in [0, π/2]: the +/// circle NURBS below is not linear in the angle, so end values are converted pointwise. +fn quarter_param(phi: f64) -> f64 { + let c = std::f64::consts::FRAC_1_SQRT_2; + let angle = |s: f64| { + let (b0, b1, b2) = ((1.0 - s) * (1.0 - s), 2.0 * s * (1.0 - s) * c, s * s); + (b1 + b2).atan2(b0 + b1) + }; + let (mut lo, mut hi) = (0.0f64, 1.0f64); + for _ in 0..64 { + let mid = 0.5 * (lo + hi); + if angle(mid) < phi { + lo = mid; + } else { + hi = mid; + } + } + 0.5 * (lo + hi) +} + +/// The circle NURBS's parameter (knots 0..4, one quarter turn per span) at `angle` after its start. +fn circle_param(angle: f64) -> f64 { + let q = std::f64::consts::FRAC_PI_2; + let a = angle.clamp(0.0, 4.0 * q); + let k = (a / q).floor().min(3.0); + k + quarter_param(a - k * q) +} + +/// A revolution, exactly, as a rational B-spline surface: each profile control point swept round +/// the axis by a full circle of four rational quadratic quarters starting at the face's first +/// angle, then mapped by the placement. The circle's parameter is not the angle, so the face's +/// angle range is converted pointwise and its pcurves are not carried (SMLib rebuilds the trims). +/// Where the placement mirrors, the record's natural normal is the opposite of the map's +/// (`brep::eval`), so the B-spline takes the two directions the other way round. +fn revolution( + a: &mut Arrays, + profile: &b::Curve, + origin: [f64; 3], + axis: [f64; 3], + m: &[[f64; 4]; 4], + forward: bool, + domain: [[f64; 2]; 2], +) -> R<()> { + let (knots, pts): (Vec, Vec<([f64; 3], f64)>) = match profile { + b::Curve::Line { start, end } => (vec![0.0, 0.0, 1.0, 1.0], vec![(*start, 1.0), (*end, 1.0)]), + b::Curve::Spline { knots, points } => (knots.clone(), points.iter().map(|p| (*p, 1.0)).collect()), + b::Curve::RationalSpline { knots, homogeneous } => { + (knots.clone(), homogeneous.iter().map(|h| ([h[0] / h[3], h[1] / h[3], h[2] / h[3]], h[3])).collect()) + } + _ => return Err(Unsupported::NotYet("revolutions of conic, polyline or intersection profiles")), + }; + let len = dot(axis, axis).sqrt(); + if !(len > 0.0) { + return Err(Unsupported::Invalid("revolution axis")); + } + let z = scale(axis, 1.0 / len); + // The record's u and v: the profile's parameter and the angle, or the other way round. + let ([p0, p1], [a0, a1]) = if forward { (domain[0], domain[1]) } else { (domain[1], domain[0]) }; + let t1 = circle_param(a1 - a0); + // Column-major placement: point' = M · (p, 1). + let place = |p: [f64; 3]| [0, 1, 2].map(|r| m[0][r] * p[0] + m[1][r] * p[1] + m[2][r] * p[2] + m[3][r]); + let det = { + let col = |c: usize| [m[c][0], m[c][1], m[c][2]]; + dot(cross(col(0), col(1)), col(2)) + }; + let c = std::f64::consts::FRAC_1_SQRT_2; + // net[i][k]: profile point i at circle control point k. + let mut net: Vec> = Vec::with_capacity(pts.len()); + for (p, w) in &pts { + let r = sub(*p, origin); + let centre = add(origin, scale(z, dot(r, z))); + let x0 = sub(*p, centre); + let y0 = cross(z, x0); + // Start at the face's first angle. + let (s0, c0) = a0.sin_cos(); + let (x, y) = (add(scale(x0, c0), scale(y0, s0)), sub(scale(y0, c0), scale(x0, s0))); + let row = (0..9) + .map(|k| { + let (sk, ck) = (k as f64 * std::f64::consts::FRAC_PI_4).sin_cos(); + let (f, wk) = if k % 2 == 1 { (1.0 / c, c) } else { (1.0, 1.0) }; + (place(add(centre, scale(add(scale(x, ck), scale(y, sk)), f))), w * wk) + }) + .collect(); + net.push(row); + } + let circle_knots = [0.0, 0.0, 0.0, 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 4.0]; + // Profile along the B-spline's first direction when the record's u is the profile and the + // placement keeps orientation, or the angle is u and it mirrors; else the angle goes first. + let profile_first = forward == (det > 0.0); + if profile_first { + nurbs_face(a, &knots, &circle_knots, pts.len(), 9)?; + net_rows(a, net.iter().flatten().copied()); + a.r(flat::FACE_RANGE).extend([p0, 0.0, p1, t1]); + } else { + nurbs_face(a, &circle_knots, &knots, 9, pts.len())?; + net_rows(a, (0..9).flat_map(|k| net.iter().filter_map(move |row| row.get(k).copied()))); + a.r(flat::FACE_RANGE).extend([0.0, p0, t1, p1]); + } + Ok(()) +} + +fn net_rows(a: &mut Arrays, cps: impl Iterator) { + net(a, cps); +} + /// A plane `origin + u·U + v·V`. With unit, orthogonal axes it is SMLib's plane, whose (u, v) are /// distances along them; otherwise it is the exact bilinear patch over the domain. fn plane(a: &mut Arrays, origin: [f64; 3], u: [f64; 3], v: [f64; 3], domain: [[f64; 2]; 2]) -> R<()> { diff --git a/crates/smlib/src/import/tests.rs b/crates/smlib/src/import/tests.rs index 32a43f339..8f286c3bd 100644 --- a/crates/smlib/src/import/tests.rs +++ b/crates/smlib/src/import/tests.rs @@ -150,3 +150,73 @@ fn a_skewed_plane_goes_as_an_exact_bilinear_patch() { let b = crate::Brep::from_record(&r, true).unwrap(); assert!((b.volume(1e-7).unwrap() - 36.0).abs() < 1e-6, "{:?}", b.volume(1e-7)); } + +/// The surface `arrays` wrote for the first face, back as a schema 4 rational spline, with its range. +fn first_nurbs(a: &Arrays) -> (Surface, [f64; 4]) { + let (nu, nv) = (a.ints[&flat::FACE_NURBS_U_VERTEX_COUNT][0] as usize, a.ints[&flat::FACE_NURBS_V_VERTEX_COUNT][0] as usize); + let cvs = &a.reals[&flat::FACE_NURBS_CVS]; + let w = &a.reals[&flat::FACE_NURBS_WEIGHTS]; + let homogeneous = (0..nu) + .map(|i| { + (0..nv) + .map(|j| { + let k = i * nv + j; + [cvs[3 * k] * w[k], cvs[3 * k + 1] * w[k], cvs[3 * k + 2] * w[k], w[k]] + }) + .collect() + }) + .collect(); + let r = &a.reals[&flat::FACE_RANGE]; + ( + Surface::RationalSpline { + u_knots: a.reals[&flat::FACE_NURBS_U_KNOTS].clone(), + v_knots: a.reals[&flat::FACE_NURBS_V_KNOTS].clone(), + homogeneous, + }, + [r[0], r[1], r[2], r[3]], + ) +} + +#[test] +fn revolutions_become_the_same_surface_as_a_rational_spline() { + use solidcraft_geom::brep::eval::SurfaceEval; + // A quarter-circle profile (rational) away from the axis, so the surface is a torus piece. + let s = std::f64::consts::FRAC_1_SQRT_2; + let profile = Curve::RationalSpline { + knots: vec![0.0, 0.0, 0.0, 1.0, 1.0, 1.0], + homogeneous: vec![[3.0, 0.0, 0.0, 1.0], [3.0 * s, 0.0, 1.0 * s, s], [2.0, 0.0, 1.0, 1.0]], + }; + let identity = [[1.0, 0.0, 0.0, 0.0], [0.0, 1.0, 0.0, 0.0], [0.0, 0.0, 1.0, 0.0], [0.0, 0.0, 0.0, 1.0]]; + let mirror = [[0.0, 1.0, 0.0, 0.0], [1.0, 0.0, 0.0, 0.0], [0.0, 0.0, 2.0, 0.0], [1.0, -2.0, 3.0, 1.0]]; + for matrix in [identity, mirror] { + for forward in [true, false] { + let rev = + Surface::PlacedRevolution { profile: Box::new(profile.clone()), origin: [0.0, 0.0, 0.0], axis: [0.0, 0.0, 1.0], matrix, forward }; + let (angles, prof) = ([0.4, 0.4 + 1.9 * std::f64::consts::PI], [0.0, 1.0]); + let domain = if forward { [prof, angles] } else { [angles, prof] }; + let mut a = Arrays::default(); + surface(&mut a, &rev, domain).unwrap(); + let (nurbs, range) = first_nurbs(&a); + let (re, ne) = (SurfaceEval::new(&rev).unwrap(), SurfaceEval::new(&nurbs).unwrap()); + let det = { + let col = |c: usize| [matrix[c][0], matrix[c][1], matrix[c][2]]; + dot(cross(col(0), col(1)), col(2)) + }; + for i in 0..=6 { + for j in 0..=6 { + let (sp, ang) = (i as f64 / 6.0, angles[0] + (angles[1] - angles[0]) * j as f64 / 6.0); + let uv = if forward { [sp, ang] } else { [ang, sp] }; + let (p, du, dv) = re.derivs(uv[0], uv[1]).unwrap(); + let n = du.cross(dv) * det.signum(); + let t = circle_param(ang - angles[0]); + let profile_first = forward == (det > 0.0); + let q = if profile_first { [sp, t] } else { [t, sp] }; + assert!(q[0] >= range[0] - 1e-12 && q[0] <= range[2] + 1e-12 && q[1] >= range[1] - 1e-12 && q[1] <= range[3] + 1e-12); + let (pn, nu_, nv_) = ne.derivs(q[0], q[1]).unwrap(); + assert!((pn - p).len() < 1e-12, "forward {forward} det {det}: {p:?} vs {pn:?}"); + assert!(nu_.cross(nv_).dot(n) > 0.0, "normal flipped: forward {forward} det {det}"); + } + } + } + } +} diff --git a/tests/ssi-corpus/LICENSE-APACHE b/tests/ssi-corpus/LICENSE-APACHE new file mode 100644 index 000000000..f433b1a53 --- /dev/null +++ b/tests/ssi-corpus/LICENSE-APACHE @@ -0,0 +1,177 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS diff --git a/tests/ssi-corpus/LICENSE-MIT b/tests/ssi-corpus/LICENSE-MIT new file mode 100644 index 000000000..bd0e0f268 --- /dev/null +++ b/tests/ssi-corpus/LICENSE-MIT @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 SolidCraft contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/tests/ssi-corpus/README.md b/tests/ssi-corpus/README.md new file mode 100644 index 000000000..74c70dd76 --- /dev/null +++ b/tests/ssi-corpus/README.md @@ -0,0 +1,51 @@ +# SSI corpus + +119 surface/surface intersection (SSI) cases with exact ground truth, from +[ssi-corpus](https://github.com/jyviko/ssi-corpus) (`cases/data`, commit b04c8a6), dual-licensed +MIT OR Apache-2.0 (`LICENSE-MIT`, `LICENSE-APACHE` here). Each case is stored gzip-compressed as +`cases/.json.gz` (the raw JSON is 31 MB; compressed, 9 MB). The content is unchanged. + +The 25 `y23_*` cases come from Yang, Jia and Yan, "Topology Guaranteed B-Spline Surface/Surface +Intersection", ACM Transactions on Graphics 42(6), Article 211, 2023 (CC BY 4.0): six use the +paper's published surfaces, nineteen are reconstructions of its figures with closed-form truth. +Each cites the paper in its `source` field. + +## A case + +- `surfaces`: the two surfaces (plane, cylinder, cone, sphere, torus as typed parameters; B-spline + and NURBS as control nets with knots and weights, optional `domain` trim box). +- `truth`: one exact description per surface, used for distances: implicit `plane`, `sphere`, + `cylinder`, `cone`, `torus`, `ellipsoid`, `quadric`, polynomial `heightfield`, or `param` (a + rational polynomial patch, distance by closest point). +- `expected`: the true intersection, sampled densely: `branches` (polylines), `isolated_points`, + `singular_points` and `coincident_regions` (boundary polylines). +- `cov_tol`: the coverage tolerance; optional `ill_cond` (conditioning factor) and `feature_size`. + +## How the tests use it + +`crates/smlib/tests/ssi_score/` is a Rust port of the corpus scorer (`scoring/score.py` and the +distance helpers of `scoring/ssi_geom.py`). It takes a case and an engine result (sampled curves +with `xyz`, `uv1`, `uv2`, both surfaces evaluated at the UV samples, the curve type; isolated +points; the status; or a crash) and returns the verdict. `crates/smlib/tests/ssi_corpus.rs` checks +the scorer on every case, and, as an ignored test, its parity with the Python scorer on the raw +runner outputs (see that file). + +## Scoring rules + +With an approximation tolerance `tol`, `acc_tol = 10 * tol`. The coverage tolerance is `cov_tol`, +widened for ill-conditioned cases to `max(cov_tol, min(0.5, 2 * acc_tol * ill_cond))`. Runs at the +engine's default tolerance have no `acc_tol` and judge coverage and joins with a floor of 5e-3 +(cases with a `feature_size` under it are N/A). Output curves of type TOUCHING, or no larger than +`cov_tol`, count as points. Verdicts, most severe first (all flags are kept): + +- CRASH: the engine died or exceeded the time limit. +- ERROR: a non-success status, unless nothing was expected and nothing was returned. +- INCOMPLETE: an expected branch, isolated point or coincident region boundary is not covered + within the coverage tolerance. +- WRONG TOPOLOGY: output off the true intersection; a different set of connected components + (curves with their free-end count, and points, joined within `cov_tol`); two output curves that + overlap by more than 20%; a singular point that no curve end or point lies on; non-finite + samples. +- INACCURATE: a 3D sample farther than `acc_tol` from either surface, or a surface evaluated at + the output UV farther than `acc_tol` from the other surface. +- PASS. diff --git a/tests/ssi-corpus/cases/c1_cone_plane_ellipse.json.gz b/tests/ssi-corpus/cases/c1_cone_plane_ellipse.json.gz new file mode 100644 index 000000000..26fb07169 Binary files /dev/null and b/tests/ssi-corpus/cases/c1_cone_plane_ellipse.json.gz differ diff --git a/tests/ssi-corpus/cases/c1_cone_plane_hyperbola.json.gz b/tests/ssi-corpus/cases/c1_cone_plane_hyperbola.json.gz new file mode 100644 index 000000000..7f8cb760d Binary files /dev/null and b/tests/ssi-corpus/cases/c1_cone_plane_hyperbola.json.gz differ diff --git a/tests/ssi-corpus/cases/c1_cyl_cyl_two_loops.json.gz b/tests/ssi-corpus/cases/c1_cyl_cyl_two_loops.json.gz new file mode 100644 index 000000000..cb3c0ce4d Binary files /dev/null and b/tests/ssi-corpus/cases/c1_cyl_cyl_two_loops.json.gz differ diff --git a/tests/ssi-corpus/cases/c1_plane_cyl_ellipse.json.gz b/tests/ssi-corpus/cases/c1_plane_cyl_ellipse.json.gz new file mode 100644 index 000000000..ce871fa0b Binary files /dev/null and b/tests/ssi-corpus/cases/c1_plane_cyl_ellipse.json.gz differ diff --git a/tests/ssi-corpus/cases/c1_plane_halfcyl_arc.json.gz b/tests/ssi-corpus/cases/c1_plane_halfcyl_arc.json.gz new file mode 100644 index 000000000..4f968ae6a Binary files /dev/null and b/tests/ssi-corpus/cases/c1_plane_halfcyl_arc.json.gz differ diff --git a/tests/ssi-corpus/cases/c1_plane_sphere_circle.json.gz b/tests/ssi-corpus/cases/c1_plane_sphere_circle.json.gz new file mode 100644 index 000000000..dd71bd2cc Binary files /dev/null and b/tests/ssi-corpus/cases/c1_plane_sphere_circle.json.gz differ diff --git a/tests/ssi-corpus/cases/c1_sphere_cyl_two_loops.json.gz b/tests/ssi-corpus/cases/c1_sphere_cyl_two_loops.json.gz new file mode 100644 index 000000000..a6a760b7c Binary files /dev/null and b/tests/ssi-corpus/cases/c1_sphere_cyl_two_loops.json.gz differ diff --git a/tests/ssi-corpus/cases/c1_torus_plane_nested.json.gz b/tests/ssi-corpus/cases/c1_torus_plane_nested.json.gz new file mode 100644 index 000000000..b8e0b16ba Binary files /dev/null and b/tests/ssi-corpus/cases/c1_torus_plane_nested.json.gz differ diff --git a/tests/ssi-corpus/cases/c1n_cylN_plane_ellipse.json.gz b/tests/ssi-corpus/cases/c1n_cylN_plane_ellipse.json.gz new file mode 100644 index 000000000..9e7cbb8b7 Binary files /dev/null and b/tests/ssi-corpus/cases/c1n_cylN_plane_ellipse.json.gz differ diff --git a/tests/ssi-corpus/cases/c1n_parab_parab_circle.json.gz b/tests/ssi-corpus/cases/c1n_parab_parab_circle.json.gz new file mode 100644 index 000000000..59ba3e526 Binary files /dev/null and b/tests/ssi-corpus/cases/c1n_parab_parab_circle.json.gz differ diff --git a/tests/ssi-corpus/cases/c1n_parab_plane_circle.json.gz b/tests/ssi-corpus/cases/c1n_parab_plane_circle.json.gz new file mode 100644 index 000000000..452a44a18 Binary files /dev/null and b/tests/ssi-corpus/cases/c1n_parab_plane_circle.json.gz differ diff --git a/tests/ssi-corpus/cases/c1n_saddle_plane_hyperbola.json.gz b/tests/ssi-corpus/cases/c1n_saddle_plane_hyperbola.json.gz new file mode 100644 index 000000000..15b945d2d Binary files /dev/null and b/tests/ssi-corpus/cases/c1n_saddle_plane_hyperbola.json.gz differ diff --git a/tests/ssi-corpus/cases/c1n_sphereN_cylN_two_loops.json.gz b/tests/ssi-corpus/cases/c1n_sphereN_cylN_two_loops.json.gz new file mode 100644 index 000000000..e9c234b69 Binary files /dev/null and b/tests/ssi-corpus/cases/c1n_sphereN_cylN_two_loops.json.gz differ diff --git a/tests/ssi-corpus/cases/c1n_torusN_planeN_nested.json.gz b/tests/ssi-corpus/cases/c1n_torusN_planeN_nested.json.gz new file mode 100644 index 000000000..101e9ae0e Binary files /dev/null and b/tests/ssi-corpus/cases/c1n_torusN_planeN_nested.json.gz differ diff --git a/tests/ssi-corpus/cases/c2_cones_tangent_ruling.json.gz b/tests/ssi-corpus/cases/c2_cones_tangent_ruling.json.gz new file mode 100644 index 000000000..5b0666cea Binary files /dev/null and b/tests/ssi-corpus/cases/c2_cones_tangent_ruling.json.gz differ diff --git a/tests/ssi-corpus/cases/c2_cyl_cyl_external.json.gz b/tests/ssi-corpus/cases/c2_cyl_cyl_external.json.gz new file mode 100644 index 000000000..940db6ff0 Binary files /dev/null and b/tests/ssi-corpus/cases/c2_cyl_cyl_external.json.gz differ diff --git a/tests/ssi-corpus/cases/c2_cyl_on_plane.json.gz b/tests/ssi-corpus/cases/c2_cyl_on_plane.json.gz new file mode 100644 index 000000000..796c56e04 Binary files /dev/null and b/tests/ssi-corpus/cases/c2_cyl_on_plane.json.gz differ diff --git a/tests/ssi-corpus/cases/c2_sphere_in_cyl.json.gz b/tests/ssi-corpus/cases/c2_sphere_in_cyl.json.gz new file mode 100644 index 000000000..f0a7c9da7 Binary files /dev/null and b/tests/ssi-corpus/cases/c2_sphere_in_cyl.json.gz differ diff --git a/tests/ssi-corpus/cases/c2_sphere_in_torus.json.gz b/tests/ssi-corpus/cases/c2_sphere_in_torus.json.gz new file mode 100644 index 000000000..fe6550c84 Binary files /dev/null and b/tests/ssi-corpus/cases/c2_sphere_in_torus.json.gz differ diff --git a/tests/ssi-corpus/cases/c2n_cylN_on_planeN.json.gz b/tests/ssi-corpus/cases/c2n_cylN_on_planeN.json.gz new file mode 100644 index 000000000..a4b45a1d0 Binary files /dev/null and b/tests/ssi-corpus/cases/c2n_cylN_on_planeN.json.gz differ diff --git a/tests/ssi-corpus/cases/c2n_parabcyl_plane.json.gz b/tests/ssi-corpus/cases/c2n_parabcyl_plane.json.gz new file mode 100644 index 000000000..52351399c Binary files /dev/null and b/tests/ssi-corpus/cases/c2n_parabcyl_plane.json.gz differ diff --git a/tests/ssi-corpus/cases/c2n_quartic_circle.json.gz b/tests/ssi-corpus/cases/c2n_quartic_circle.json.gz new file mode 100644 index 000000000..8af0b6ee4 Binary files /dev/null and b/tests/ssi-corpus/cases/c2n_quartic_circle.json.gz differ diff --git a/tests/ssi-corpus/cases/c2n_quartic_contact_parabola.json.gz b/tests/ssi-corpus/cases/c2n_quartic_contact_parabola.json.gz new file mode 100644 index 000000000..eac8b8d35 Binary files /dev/null and b/tests/ssi-corpus/cases/c2n_quartic_contact_parabola.json.gz differ diff --git a/tests/ssi-corpus/cases/c2n_sphereN_in_cyl.json.gz b/tests/ssi-corpus/cases/c2n_sphereN_in_cyl.json.gz new file mode 100644 index 000000000..61e155562 Binary files /dev/null and b/tests/ssi-corpus/cases/c2n_sphereN_in_cyl.json.gz differ diff --git a/tests/ssi-corpus/cases/c3_sphere_on_plane.json.gz b/tests/ssi-corpus/cases/c3_sphere_on_plane.json.gz new file mode 100644 index 000000000..3dda43f77 Binary files /dev/null and b/tests/ssi-corpus/cases/c3_sphere_on_plane.json.gz differ diff --git a/tests/ssi-corpus/cases/c3_sphere_torus_outer.json.gz b/tests/ssi-corpus/cases/c3_sphere_torus_outer.json.gz new file mode 100644 index 000000000..accac0e8f Binary files /dev/null and b/tests/ssi-corpus/cases/c3_sphere_torus_outer.json.gz differ diff --git a/tests/ssi-corpus/cases/c3_spheres_external.json.gz b/tests/ssi-corpus/cases/c3_spheres_external.json.gz new file mode 100644 index 000000000..03faf3715 Binary files /dev/null and b/tests/ssi-corpus/cases/c3_spheres_external.json.gz differ diff --git a/tests/ssi-corpus/cases/c3_spheres_internal.json.gz b/tests/ssi-corpus/cases/c3_spheres_internal.json.gz new file mode 100644 index 000000000..4146a5d6b Binary files /dev/null and b/tests/ssi-corpus/cases/c3_spheres_internal.json.gz differ diff --git a/tests/ssi-corpus/cases/c3n_four_points.json.gz b/tests/ssi-corpus/cases/c3n_four_points.json.gz new file mode 100644 index 000000000..bcad4c634 Binary files /dev/null and b/tests/ssi-corpus/cases/c3n_four_points.json.gz differ diff --git a/tests/ssi-corpus/cases/c3n_parab_apex.json.gz b/tests/ssi-corpus/cases/c3n_parab_apex.json.gz new file mode 100644 index 000000000..6a915b6f9 Binary files /dev/null and b/tests/ssi-corpus/cases/c3n_parab_apex.json.gz differ diff --git a/tests/ssi-corpus/cases/c3n_parab_parab_apex.json.gz b/tests/ssi-corpus/cases/c3n_parab_parab_apex.json.gz new file mode 100644 index 000000000..0535a7a4b Binary files /dev/null and b/tests/ssi-corpus/cases/c3n_parab_parab_apex.json.gz differ diff --git a/tests/ssi-corpus/cases/c4_cone_apex_plane.json.gz b/tests/ssi-corpus/cases/c4_cone_apex_plane.json.gz new file mode 100644 index 000000000..60bf9b0b4 Binary files /dev/null and b/tests/ssi-corpus/cases/c4_cone_apex_plane.json.gz differ diff --git a/tests/ssi-corpus/cases/c4_steinmetz.json.gz b/tests/ssi-corpus/cases/c4_steinmetz.json.gz new file mode 100644 index 000000000..132bf044f Binary files /dev/null and b/tests/ssi-corpus/cases/c4_steinmetz.json.gz differ diff --git a/tests/ssi-corpus/cases/c4_viviani_figure8.json.gz b/tests/ssi-corpus/cases/c4_viviani_figure8.json.gz new file mode 100644 index 000000000..39e21e7d7 Binary files /dev/null and b/tests/ssi-corpus/cases/c4_viviani_figure8.json.gz differ diff --git a/tests/ssi-corpus/cases/c4n_cusp.json.gz b/tests/ssi-corpus/cases/c4n_cusp.json.gz new file mode 100644 index 000000000..49293f9c9 Binary files /dev/null and b/tests/ssi-corpus/cases/c4n_cusp.json.gz differ diff --git a/tests/ssi-corpus/cases/c4n_saddle_tangent_plane.json.gz b/tests/ssi-corpus/cases/c4n_saddle_tangent_plane.json.gz new file mode 100644 index 000000000..46496c345 Binary files /dev/null and b/tests/ssi-corpus/cases/c4n_saddle_tangent_plane.json.gz differ diff --git a/tests/ssi-corpus/cases/c4n_viviani_nurbs.json.gz b/tests/ssi-corpus/cases/c4n_viviani_nurbs.json.gz new file mode 100644 index 000000000..6125c803a Binary files /dev/null and b/tests/ssi-corpus/cases/c4n_viviani_nurbs.json.gz differ diff --git a/tests/ssi-corpus/cases/c5_corner_to_corner.json.gz b/tests/ssi-corpus/cases/c5_corner_to_corner.json.gz new file mode 100644 index 000000000..527a7bd3c Binary files /dev/null and b/tests/ssi-corpus/cases/c5_corner_to_corner.json.gz differ diff --git a/tests/ssi-corpus/cases/c5_curve_on_edge.json.gz b/tests/ssi-corpus/cases/c5_curve_on_edge.json.gz new file mode 100644 index 000000000..51601e496 Binary files /dev/null and b/tests/ssi-corpus/cases/c5_curve_on_edge.json.gz differ diff --git a/tests/ssi-corpus/cases/c5_cyl_end_circle.json.gz b/tests/ssi-corpus/cases/c5_cyl_end_circle.json.gz new file mode 100644 index 000000000..f2c90eb93 Binary files /dev/null and b/tests/ssi-corpus/cases/c5_cyl_end_circle.json.gz differ diff --git a/tests/ssi-corpus/cases/c5_cyl_quilt_seam.json.gz b/tests/ssi-corpus/cases/c5_cyl_quilt_seam.json.gz new file mode 100644 index 000000000..b8f4fd966 Binary files /dev/null and b/tests/ssi-corpus/cases/c5_cyl_quilt_seam.json.gz differ diff --git a/tests/ssi-corpus/cases/c5_hemisphere_equator.json.gz b/tests/ssi-corpus/cases/c5_hemisphere_equator.json.gz new file mode 100644 index 000000000..22cad7522 Binary files /dev/null and b/tests/ssi-corpus/cases/c5_hemisphere_equator.json.gz differ diff --git a/tests/ssi-corpus/cases/c5_shared_border_L.json.gz b/tests/ssi-corpus/cases/c5_shared_border_L.json.gz new file mode 100644 index 000000000..8c85354ba Binary files /dev/null and b/tests/ssi-corpus/cases/c5_shared_border_L.json.gz differ diff --git a/tests/ssi-corpus/cases/c5n_curve_on_edge.json.gz b/tests/ssi-corpus/cases/c5n_curve_on_edge.json.gz new file mode 100644 index 000000000..e0c4ef1d7 Binary files /dev/null and b/tests/ssi-corpus/cases/c5n_curve_on_edge.json.gz differ diff --git a/tests/ssi-corpus/cases/c5n_cylN_quilt_seam.json.gz b/tests/ssi-corpus/cases/c5n_cylN_quilt_seam.json.gz new file mode 100644 index 000000000..60fd3d932 Binary files /dev/null and b/tests/ssi-corpus/cases/c5n_cylN_quilt_seam.json.gz differ diff --git a/tests/ssi-corpus/cases/c6_cyl_overlap.json.gz b/tests/ssi-corpus/cases/c6_cyl_overlap.json.gz new file mode 100644 index 000000000..25d3d1e35 Binary files /dev/null and b/tests/ssi-corpus/cases/c6_cyl_overlap.json.gz differ diff --git a/tests/ssi-corpus/cases/c6_planes_identical.json.gz b/tests/ssi-corpus/cases/c6_planes_identical.json.gz new file mode 100644 index 000000000..9a5b1f979 Binary files /dev/null and b/tests/ssi-corpus/cases/c6_planes_identical.json.gz differ diff --git a/tests/ssi-corpus/cases/c6_planes_overlap.json.gz b/tests/ssi-corpus/cases/c6_planes_overlap.json.gz new file mode 100644 index 000000000..9065aeb8c Binary files /dev/null and b/tests/ssi-corpus/cases/c6_planes_overlap.json.gz differ diff --git a/tests/ssi-corpus/cases/c6_spheres_overlap.json.gz b/tests/ssi-corpus/cases/c6_spheres_overlap.json.gz new file mode 100644 index 000000000..19f8690aa Binary files /dev/null and b/tests/ssi-corpus/cases/c6_spheres_overlap.json.gz differ diff --git a/tests/ssi-corpus/cases/c6n_cyl_vs_nurbscyl.json.gz b/tests/ssi-corpus/cases/c6n_cyl_vs_nurbscyl.json.gz new file mode 100644 index 000000000..c00d0530f Binary files /dev/null and b/tests/ssi-corpus/cases/c6n_cyl_vs_nurbscyl.json.gz differ diff --git a/tests/ssi-corpus/cases/c6n_plane_vs_nurbsplane.json.gz b/tests/ssi-corpus/cases/c6n_plane_vs_nurbsplane.json.gz new file mode 100644 index 000000000..0ac23bafc Binary files /dev/null and b/tests/ssi-corpus/cases/c6n_plane_vs_nurbsplane.json.gz differ diff --git a/tests/ssi-corpus/cases/c6n_sphere_vs_nurbssphere.json.gz b/tests/ssi-corpus/cases/c6n_sphere_vs_nurbssphere.json.gz new file mode 100644 index 000000000..9ca1cb2d0 Binary files /dev/null and b/tests/ssi-corpus/cases/c6n_sphere_vs_nurbssphere.json.gz differ diff --git a/tests/ssi-corpus/cases/c7_angle_planes_1e-3.json.gz b/tests/ssi-corpus/cases/c7_angle_planes_1e-3.json.gz new file mode 100644 index 000000000..b78244937 Binary files /dev/null and b/tests/ssi-corpus/cases/c7_angle_planes_1e-3.json.gz differ diff --git a/tests/ssi-corpus/cases/c7_angle_planes_1e-4.json.gz b/tests/ssi-corpus/cases/c7_angle_planes_1e-4.json.gz new file mode 100644 index 000000000..309cff5bf Binary files /dev/null and b/tests/ssi-corpus/cases/c7_angle_planes_1e-4.json.gz differ diff --git a/tests/ssi-corpus/cases/c7_angle_planes_1e-5.json.gz b/tests/ssi-corpus/cases/c7_angle_planes_1e-5.json.gz new file mode 100644 index 000000000..0b5f8b99e Binary files /dev/null and b/tests/ssi-corpus/cases/c7_angle_planes_1e-5.json.gz differ diff --git a/tests/ssi-corpus/cases/c7_angle_planes_1e-6.json.gz b/tests/ssi-corpus/cases/c7_angle_planes_1e-6.json.gz new file mode 100644 index 000000000..9ceecde5d Binary files /dev/null and b/tests/ssi-corpus/cases/c7_angle_planes_1e-6.json.gz differ diff --git a/tests/ssi-corpus/cases/c7_angle_planes_1e-7.json.gz b/tests/ssi-corpus/cases/c7_angle_planes_1e-7.json.gz new file mode 100644 index 000000000..51d7daece Binary files /dev/null and b/tests/ssi-corpus/cases/c7_angle_planes_1e-7.json.gz differ diff --git a/tests/ssi-corpus/cases/c7_angle_planes_1e-8.json.gz b/tests/ssi-corpus/cases/c7_angle_planes_1e-8.json.gz new file mode 100644 index 000000000..bccb47794 Binary files /dev/null and b/tests/ssi-corpus/cases/c7_angle_planes_1e-8.json.gz differ diff --git a/tests/ssi-corpus/cases/c7_offset_planes_1e-3.json.gz b/tests/ssi-corpus/cases/c7_offset_planes_1e-3.json.gz new file mode 100644 index 000000000..539feb8e8 Binary files /dev/null and b/tests/ssi-corpus/cases/c7_offset_planes_1e-3.json.gz differ diff --git a/tests/ssi-corpus/cases/c7_offset_planes_1e-5.json.gz b/tests/ssi-corpus/cases/c7_offset_planes_1e-5.json.gz new file mode 100644 index 000000000..2db49bf63 Binary files /dev/null and b/tests/ssi-corpus/cases/c7_offset_planes_1e-5.json.gz differ diff --git a/tests/ssi-corpus/cases/c7_offset_planes_1e-7.json.gz b/tests/ssi-corpus/cases/c7_offset_planes_1e-7.json.gz new file mode 100644 index 000000000..2378fd83b Binary files /dev/null and b/tests/ssi-corpus/cases/c7_offset_planes_1e-7.json.gz differ diff --git a/tests/ssi-corpus/cases/c7_offset_spheres_1e-3.json.gz b/tests/ssi-corpus/cases/c7_offset_spheres_1e-3.json.gz new file mode 100644 index 000000000..1105c0471 Binary files /dev/null and b/tests/ssi-corpus/cases/c7_offset_spheres_1e-3.json.gz differ diff --git a/tests/ssi-corpus/cases/c7_offset_spheres_1e-5.json.gz b/tests/ssi-corpus/cases/c7_offset_spheres_1e-5.json.gz new file mode 100644 index 000000000..395240989 Binary files /dev/null and b/tests/ssi-corpus/cases/c7_offset_spheres_1e-5.json.gz differ diff --git a/tests/ssi-corpus/cases/c7_offset_spheres_1e-7.json.gz b/tests/ssi-corpus/cases/c7_offset_spheres_1e-7.json.gz new file mode 100644 index 000000000..02c04cd03 Binary files /dev/null and b/tests/ssi-corpus/cases/c7_offset_spheres_1e-7.json.gz differ diff --git a/tests/ssi-corpus/cases/c7_sunk_cyl_1e-3.json.gz b/tests/ssi-corpus/cases/c7_sunk_cyl_1e-3.json.gz new file mode 100644 index 000000000..66ee7afe4 Binary files /dev/null and b/tests/ssi-corpus/cases/c7_sunk_cyl_1e-3.json.gz differ diff --git a/tests/ssi-corpus/cases/c7_sunk_cyl_1e-4.json.gz b/tests/ssi-corpus/cases/c7_sunk_cyl_1e-4.json.gz new file mode 100644 index 000000000..6b3c7e04b Binary files /dev/null and b/tests/ssi-corpus/cases/c7_sunk_cyl_1e-4.json.gz differ diff --git a/tests/ssi-corpus/cases/c7_sunk_cyl_1e-5.json.gz b/tests/ssi-corpus/cases/c7_sunk_cyl_1e-5.json.gz new file mode 100644 index 000000000..259d6a255 Binary files /dev/null and b/tests/ssi-corpus/cases/c7_sunk_cyl_1e-5.json.gz differ diff --git a/tests/ssi-corpus/cases/c7_sunk_cyl_1e-6.json.gz b/tests/ssi-corpus/cases/c7_sunk_cyl_1e-6.json.gz new file mode 100644 index 000000000..a1795b105 Binary files /dev/null and b/tests/ssi-corpus/cases/c7_sunk_cyl_1e-6.json.gz differ diff --git a/tests/ssi-corpus/cases/c7_tiny_loop_parab_1e-4.json.gz b/tests/ssi-corpus/cases/c7_tiny_loop_parab_1e-4.json.gz new file mode 100644 index 000000000..cc203b684 Binary files /dev/null and b/tests/ssi-corpus/cases/c7_tiny_loop_parab_1e-4.json.gz differ diff --git a/tests/ssi-corpus/cases/c7_tiny_loop_parab_1e-5.json.gz b/tests/ssi-corpus/cases/c7_tiny_loop_parab_1e-5.json.gz new file mode 100644 index 000000000..6ad283bd4 Binary files /dev/null and b/tests/ssi-corpus/cases/c7_tiny_loop_parab_1e-5.json.gz differ diff --git a/tests/ssi-corpus/cases/c7_tiny_loop_parab_1e-6.json.gz b/tests/ssi-corpus/cases/c7_tiny_loop_parab_1e-6.json.gz new file mode 100644 index 000000000..30730a2c8 Binary files /dev/null and b/tests/ssi-corpus/cases/c7_tiny_loop_parab_1e-6.json.gz differ diff --git a/tests/ssi-corpus/cases/c7_tiny_loop_parab_1e-7.json.gz b/tests/ssi-corpus/cases/c7_tiny_loop_parab_1e-7.json.gz new file mode 100644 index 000000000..fafc6248b Binary files /dev/null and b/tests/ssi-corpus/cases/c7_tiny_loop_parab_1e-7.json.gz differ diff --git a/tests/ssi-corpus/cases/c7_tiny_loop_sphere_1e-4.json.gz b/tests/ssi-corpus/cases/c7_tiny_loop_sphere_1e-4.json.gz new file mode 100644 index 000000000..448f8e27b Binary files /dev/null and b/tests/ssi-corpus/cases/c7_tiny_loop_sphere_1e-4.json.gz differ diff --git a/tests/ssi-corpus/cases/c7_tiny_loop_sphere_1e-5.json.gz b/tests/ssi-corpus/cases/c7_tiny_loop_sphere_1e-5.json.gz new file mode 100644 index 000000000..da1fc2646 Binary files /dev/null and b/tests/ssi-corpus/cases/c7_tiny_loop_sphere_1e-5.json.gz differ diff --git a/tests/ssi-corpus/cases/c7_tiny_loop_sphere_1e-6.json.gz b/tests/ssi-corpus/cases/c7_tiny_loop_sphere_1e-6.json.gz new file mode 100644 index 000000000..c172c4595 Binary files /dev/null and b/tests/ssi-corpus/cases/c7_tiny_loop_sphere_1e-6.json.gz differ diff --git a/tests/ssi-corpus/cases/c7_tiny_loop_sphere_1e-7.json.gz b/tests/ssi-corpus/cases/c7_tiny_loop_sphere_1e-7.json.gz new file mode 100644 index 000000000..5b793d88a Binary files /dev/null and b/tests/ssi-corpus/cases/c7_tiny_loop_sphere_1e-7.json.gz differ diff --git a/tests/ssi-corpus/cases/c8_cone_plane_seam.json.gz b/tests/ssi-corpus/cases/c8_cone_plane_seam.json.gz new file mode 100644 index 000000000..27a65883a Binary files /dev/null and b/tests/ssi-corpus/cases/c8_cone_plane_seam.json.gz differ diff --git a/tests/ssi-corpus/cases/c8_cyl_plane_seam_line.json.gz b/tests/ssi-corpus/cases/c8_cyl_plane_seam_line.json.gz new file mode 100644 index 000000000..d132dfa29 Binary files /dev/null and b/tests/ssi-corpus/cases/c8_cyl_plane_seam_line.json.gz differ diff --git a/tests/ssi-corpus/cases/c8_sphere_cyl_through_poles.json.gz b/tests/ssi-corpus/cases/c8_sphere_cyl_through_poles.json.gz new file mode 100644 index 000000000..59bf24bc3 Binary files /dev/null and b/tests/ssi-corpus/cases/c8_sphere_cyl_through_poles.json.gz differ diff --git a/tests/ssi-corpus/cases/c8_sphere_plane_poles.json.gz b/tests/ssi-corpus/cases/c8_sphere_plane_poles.json.gz new file mode 100644 index 000000000..30ea5b7b2 Binary files /dev/null and b/tests/ssi-corpus/cases/c8_sphere_plane_poles.json.gz differ diff --git a/tests/ssi-corpus/cases/c8_sphere_plane_poles_seam.json.gz b/tests/ssi-corpus/cases/c8_sphere_plane_poles_seam.json.gz new file mode 100644 index 000000000..dbfd45504 Binary files /dev/null and b/tests/ssi-corpus/cases/c8_sphere_plane_poles_seam.json.gz differ diff --git a/tests/ssi-corpus/cases/c8_sphere_polar_cap.json.gz b/tests/ssi-corpus/cases/c8_sphere_polar_cap.json.gz new file mode 100644 index 000000000..ac22ccce7 Binary files /dev/null and b/tests/ssi-corpus/cases/c8_sphere_polar_cap.json.gz differ diff --git a/tests/ssi-corpus/cases/c8_torus_axis_plane_seam.json.gz b/tests/ssi-corpus/cases/c8_torus_axis_plane_seam.json.gz new file mode 100644 index 000000000..667de37be Binary files /dev/null and b/tests/ssi-corpus/cases/c8_torus_axis_plane_seam.json.gz differ diff --git a/tests/ssi-corpus/cases/c8_torus_equator_seam.json.gz b/tests/ssi-corpus/cases/c8_torus_equator_seam.json.gz new file mode 100644 index 000000000..452e2857d Binary files /dev/null and b/tests/ssi-corpus/cases/c8_torus_equator_seam.json.gz differ diff --git a/tests/ssi-corpus/cases/c8n_cylN_seam_line.json.gz b/tests/ssi-corpus/cases/c8n_cylN_seam_line.json.gz new file mode 100644 index 000000000..225b8fad0 Binary files /dev/null and b/tests/ssi-corpus/cases/c8n_cylN_seam_line.json.gz differ diff --git a/tests/ssi-corpus/cases/c8n_sphereN_polar_cap.json.gz b/tests/ssi-corpus/cases/c8n_sphereN_polar_cap.json.gz new file mode 100644 index 000000000..f72d7eca6 Binary files /dev/null and b/tests/ssi-corpus/cases/c8n_sphereN_polar_cap.json.gz differ diff --git a/tests/ssi-corpus/cases/c8n_sphereN_poles.json.gz b/tests/ssi-corpus/cases/c8n_sphereN_poles.json.gz new file mode 100644 index 000000000..359a92b9d Binary files /dev/null and b/tests/ssi-corpus/cases/c8n_sphereN_poles.json.gz differ diff --git a/tests/ssi-corpus/cases/c8n_torusN_equator_seam.json.gz b/tests/ssi-corpus/cases/c8n_torusN_equator_seam.json.gz new file mode 100644 index 000000000..ded6823d9 Binary files /dev/null and b/tests/ssi-corpus/cases/c8n_torusN_equator_seam.json.gz differ diff --git a/tests/ssi-corpus/cases/c9n_deg6_circle.json.gz b/tests/ssi-corpus/cases/c9n_deg6_circle.json.gz new file mode 100644 index 000000000..0385f8d9b Binary files /dev/null and b/tests/ssi-corpus/cases/c9n_deg6_circle.json.gz differ diff --git a/tests/ssi-corpus/cases/c9n_elevated_paraboloids.json.gz b/tests/ssi-corpus/cases/c9n_elevated_paraboloids.json.gz new file mode 100644 index 000000000..6f2dc2844 Binary files /dev/null and b/tests/ssi-corpus/cases/c9n_elevated_paraboloids.json.gz differ diff --git a/tests/ssi-corpus/cases/c9n_many_spans_plane_sphere.json.gz b/tests/ssi-corpus/cases/c9n_many_spans_plane_sphere.json.gz new file mode 100644 index 000000000..08f058627 Binary files /dev/null and b/tests/ssi-corpus/cases/c9n_many_spans_plane_sphere.json.gz differ diff --git a/tests/ssi-corpus/cases/c9n_rational_deg5_cyl_arc.json.gz b/tests/ssi-corpus/cases/c9n_rational_deg5_cyl_arc.json.gz new file mode 100644 index 000000000..3f9f3cc19 Binary files /dev/null and b/tests/ssi-corpus/cases/c9n_rational_deg5_cyl_arc.json.gz differ diff --git a/tests/ssi-corpus/cases/c9n_rational_deg5_sphere_arc.json.gz b/tests/ssi-corpus/cases/c9n_rational_deg5_sphere_arc.json.gz new file mode 100644 index 000000000..0bf87b1a4 Binary files /dev/null and b/tests/ssi-corpus/cases/c9n_rational_deg5_sphere_arc.json.gz differ diff --git a/tests/ssi-corpus/cases/c9n_refined_torus_sphere.json.gz b/tests/ssi-corpus/cases/c9n_refined_torus_sphere.json.gz new file mode 100644 index 000000000..ca2f2405c Binary files /dev/null and b/tests/ssi-corpus/cases/c9n_refined_torus_sphere.json.gz differ diff --git a/tests/ssi-corpus/cases/y23_appendix_ex2.json.gz b/tests/ssi-corpus/cases/y23_appendix_ex2.json.gz new file mode 100644 index 000000000..5982708d9 Binary files /dev/null and b/tests/ssi-corpus/cases/y23_appendix_ex2.json.gz differ diff --git a/tests/ssi-corpus/cases/y23_fig1a_two_loops_cross.json.gz b/tests/ssi-corpus/cases/y23_fig1a_two_loops_cross.json.gz new file mode 100644 index 000000000..36fd39e01 Binary files /dev/null and b/tests/ssi-corpus/cases/y23_fig1a_two_loops_cross.json.gz differ diff --git a/tests/ssi-corpus/cases/y23_fig1b_two_arcs_and_point.json.gz b/tests/ssi-corpus/cases/y23_fig1b_two_arcs_and_point.json.gz new file mode 100644 index 000000000..234d9f945 Binary files /dev/null and b/tests/ssi-corpus/cases/y23_fig1b_two_arcs_and_point.json.gz differ diff --git a/tests/ssi-corpus/cases/y23_fig1c_boundary_triangle.json.gz b/tests/ssi-corpus/cases/y23_fig1c_boundary_triangle.json.gz new file mode 100644 index 000000000..fecb1285f Binary files /dev/null and b/tests/ssi-corpus/cases/y23_fig1c_boundary_triangle.json.gz differ diff --git a/tests/ssi-corpus/cases/y23_fig1d_two_quads.json.gz b/tests/ssi-corpus/cases/y23_fig1d_two_quads.json.gz new file mode 100644 index 000000000..216f48250 Binary files /dev/null and b/tests/ssi-corpus/cases/y23_fig1d_two_quads.json.gz differ diff --git a/tests/ssi-corpus/cases/y23_fig1e_loops_touching.json.gz b/tests/ssi-corpus/cases/y23_fig1e_loops_touching.json.gz new file mode 100644 index 000000000..a459df05f Binary files /dev/null and b/tests/ssi-corpus/cases/y23_fig1e_loops_touching.json.gz differ diff --git a/tests/ssi-corpus/cases/y23_fig1f_high_order_contact.json.gz b/tests/ssi-corpus/cases/y23_fig1f_high_order_contact.json.gz new file mode 100644 index 000000000..051a546aa Binary files /dev/null and b/tests/ssi-corpus/cases/y23_fig1f_high_order_contact.json.gz differ diff --git a/tests/ssi-corpus/cases/y23_fig1g_three_points.json.gz b/tests/ssi-corpus/cases/y23_fig1g_three_points.json.gz new file mode 100644 index 000000000..0d385fda5 Binary files /dev/null and b/tests/ssi-corpus/cases/y23_fig1g_three_points.json.gz differ diff --git a/tests/ssi-corpus/cases/y23_t2_ex1_tangent_line.json.gz b/tests/ssi-corpus/cases/y23_t2_ex1_tangent_line.json.gz new file mode 100644 index 000000000..a0e0fd47d Binary files /dev/null and b/tests/ssi-corpus/cases/y23_t2_ex1_tangent_line.json.gz differ diff --git a/tests/ssi-corpus/cases/y23_t2_ex2_tangential_curve.json.gz b/tests/ssi-corpus/cases/y23_t2_ex2_tangential_curve.json.gz new file mode 100644 index 000000000..c43186020 Binary files /dev/null and b/tests/ssi-corpus/cases/y23_t2_ex2_tangential_curve.json.gz differ diff --git a/tests/ssi-corpus/cases/y23_t2_ex3_loop_two_curves.json.gz b/tests/ssi-corpus/cases/y23_t2_ex3_loop_two_curves.json.gz new file mode 100644 index 000000000..723766010 Binary files /dev/null and b/tests/ssi-corpus/cases/y23_t2_ex3_loop_two_curves.json.gz differ diff --git a/tests/ssi-corpus/cases/y23_t2_ex4_tangential_curve_saddle.json.gz b/tests/ssi-corpus/cases/y23_t2_ex4_tangential_curve_saddle.json.gz new file mode 100644 index 000000000..a5d40b753 Binary files /dev/null and b/tests/ssi-corpus/cases/y23_t2_ex4_tangential_curve_saddle.json.gz differ diff --git a/tests/ssi-corpus/cases/y23_t2_ex5_two_loops.json.gz b/tests/ssi-corpus/cases/y23_t2_ex5_two_loops.json.gz new file mode 100644 index 000000000..b40db47c8 Binary files /dev/null and b/tests/ssi-corpus/cases/y23_t2_ex5_two_loops.json.gz differ diff --git a/tests/ssi-corpus/cases/y23_t2_ex6_loop_and_point.json.gz b/tests/ssi-corpus/cases/y23_t2_ex6_loop_and_point.json.gz new file mode 100644 index 000000000..68131cbda Binary files /dev/null and b/tests/ssi-corpus/cases/y23_t2_ex6_loop_and_point.json.gz differ diff --git a/tests/ssi-corpus/cases/y23_t3_ex1_torus_ellipsoid.json.gz b/tests/ssi-corpus/cases/y23_t3_ex1_torus_ellipsoid.json.gz new file mode 100644 index 000000000..4a75db23a Binary files /dev/null and b/tests/ssi-corpus/cases/y23_t3_ex1_torus_ellipsoid.json.gz differ diff --git a/tests/ssi-corpus/cases/y23_t3_ex2_torus_ellipsoid.json.gz b/tests/ssi-corpus/cases/y23_t3_ex2_torus_ellipsoid.json.gz new file mode 100644 index 000000000..149921273 Binary files /dev/null and b/tests/ssi-corpus/cases/y23_t3_ex2_torus_ellipsoid.json.gz differ diff --git a/tests/ssi-corpus/cases/y23_t3_ex3_torus_ellipsoid.json.gz b/tests/ssi-corpus/cases/y23_t3_ex3_torus_ellipsoid.json.gz new file mode 100644 index 000000000..e81e5f88d Binary files /dev/null and b/tests/ssi-corpus/cases/y23_t3_ex3_torus_ellipsoid.json.gz differ diff --git a/tests/ssi-corpus/cases/y23_t3_ex4_torus_ellipsoid.json.gz b/tests/ssi-corpus/cases/y23_t3_ex4_torus_ellipsoid.json.gz new file mode 100644 index 000000000..5ba3da8bd Binary files /dev/null and b/tests/ssi-corpus/cases/y23_t3_ex4_torus_ellipsoid.json.gz differ diff --git a/tests/ssi-corpus/cases/y23_t3_ex5_torus_ellipsoid.json.gz b/tests/ssi-corpus/cases/y23_t3_ex5_torus_ellipsoid.json.gz new file mode 100644 index 000000000..fc1ad9b21 Binary files /dev/null and b/tests/ssi-corpus/cases/y23_t3_ex5_torus_ellipsoid.json.gz differ diff --git a/tests/ssi-corpus/cases/y23_t6_ex1_tangent_line.json.gz b/tests/ssi-corpus/cases/y23_t6_ex1_tangent_line.json.gz new file mode 100644 index 000000000..a284b83c6 Binary files /dev/null and b/tests/ssi-corpus/cases/y23_t6_ex1_tangent_line.json.gz differ diff --git a/tests/ssi-corpus/cases/y23_t6_ex2_tangential_arc.json.gz b/tests/ssi-corpus/cases/y23_t6_ex2_tangential_arc.json.gz new file mode 100644 index 000000000..50fc5bc94 Binary files /dev/null and b/tests/ssi-corpus/cases/y23_t6_ex2_tangential_arc.json.gz differ diff --git a/tests/ssi-corpus/cases/y23_t6_ex3_two_crossing_curves.json.gz b/tests/ssi-corpus/cases/y23_t6_ex3_two_crossing_curves.json.gz new file mode 100644 index 000000000..8ea15cf86 Binary files /dev/null and b/tests/ssi-corpus/cases/y23_t6_ex3_two_crossing_curves.json.gz differ diff --git a/tests/ssi-corpus/cases/y23_t6_ex4_tangential_point.json.gz b/tests/ssi-corpus/cases/y23_t6_ex4_tangential_point.json.gz new file mode 100644 index 000000000..ef19753d0 Binary files /dev/null and b/tests/ssi-corpus/cases/y23_t6_ex4_tangential_point.json.gz differ diff --git a/tests/ssi-corpus/cases/y23_t6_ex5_four_boundary_curves.json.gz b/tests/ssi-corpus/cases/y23_t6_ex5_four_boundary_curves.json.gz new file mode 100644 index 000000000..0662052d3 Binary files /dev/null and b/tests/ssi-corpus/cases/y23_t6_ex5_four_boundary_curves.json.gz differ diff --git a/tests/ssi-corpus/cases/y23_t6_ex6_four_boundary_curves.json.gz b/tests/ssi-corpus/cases/y23_t6_ex6_four_boundary_curves.json.gz new file mode 100644 index 000000000..958531c46 Binary files /dev/null and b/tests/ssi-corpus/cases/y23_t6_ex6_four_boundary_curves.json.gz differ