Repository navigation
fix(operations): revolve an ellipse or spline edge as one wall, full or part turn - #2940
Merged
Merged
Conversation
A profile edge that is an ellipse or B-spline arc clear of the axis now takes the analytic full-revolution path: one rational B-spline wall from the nine-point circle, beside the lines' exact planes and cylinders. A part turn keeps its plane and cylinder faces whole; its caps stay faces of their own, as a half turn sets them in one plane either side of the axis, and a line square to the axis from a point on it no longer counts as touching it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…wall A part turn built the wall of a curved profile edge other than a circle one face per quarter turn, while its line and circle neighbours' bands merged into one face each: a half turn of an ellipse arc gave two wall faces, three quarters three. The wall is now one rational surface with a span per quarter turn, bounded by the edge at each end and the rim arcs of every quarter. An edge with an end on the axis keeps its wedges. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
PR author is not in the allowed authors list. |
This was referenced Nov 27, 2026
andymai
added a commit
that referenced
this pull request
Nov 29, 2026
## Summary `nurbs_face_over_domain` integrates a face that is its whole B-spline surface directly over the surface's `(u, v)` domain, in panels between its knots. Besides open patches it takes a band closed along `v`, a blend round a closed rim, whose wire runs both closed sides and its seam once each way. A wall turned a whole turn with the turn along `u` is closed along `u` instead. A full revolve of an ellipse or spline profile edge builds one like this (#2940). The domain path declined it, so it fell to `nurbs_face_by_boundary`, which projects every boundary point onto the surface. Such a wall is now read through its transpose: the same surface with `u` and `v` swapped, whose normal points the other way, so its integrals come out the same under the opposite sign. `closed_along_u_and_poleless` is `closed_along_v_and_poleless` with the sides swapped. For a profile of five lines and one ellipse arc turned a whole turn about z: | | before | after | |---|---|---| | the wall's integral | 15 ms | 4.5 ms | | `solid_volume` (mean of 50) | 24.8 ms | 2.65 ms | | volume against the closed form | 4e-16 | 3e-15 | The half turn's wall, already open, takes 3.2 ms either way. ## Tests `a_wall_closed_along_u_is_read_over_its_domain` builds a cylinder wall of radius 5 and height 10 as a rational B-spline, turned in quarters along `u` and, as a check, along `v`. It asserts: - both read over their domain, at the closed-form area and volume to 1e-12; - the two agree on the moments. It fails without the change: the domain path returns `None` for the wall turned along `u`. `cargo test -p brepkit-check` passes on this branch. 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Speeds up domain integration of NURBS walls closed along `u`, such as a full revolve's wall, which previously fell back to slower boundary projection. The surface is read as its transpose — `u` and `v` swapped, normal negated — so the integrals keep their sign. A wall's integral drops from 15 ms to 4.5 ms, `solid_volume` from 24.8 ms to 2.65 ms. - Adds a test that reads a cylinder wall turned in quarters along both `u` and `v`, asserting both integrate over their domain with matching area, volume, and moments; it fails before the change. <sup>Written for commit ec52852. Summary will update on new commits.</sup> <a href="https://cubic.dev/pr/andymai/brepkit/pull/2941?utm_source=github" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img alt="View guided diff" src="https://www.cubic.dev/buttons/review-in-cubic-light.svg"></picture></a> <!-- End of auto-generated description by cubic. --> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Andy Aragon <hi@andymai.com>
…keep a circle arc's sphere A full turn now reads the wall's normal and the edge's tangent at the middle of one knot span. A secant across a knot or a narrow span can run against the tangent of the span that gives the normal, and the wall then faced into the solid. A circle arc that is stored as a B-spline keeps the segmented path, which sweeps its exact sphere. A spline edge sweeps one wall only where the hull of each Bezier piece shows that it keeps clear of the axis. Samples miss a narrow span that comes to the axis. Tests: a turn at the middle knot, a step back in a narrow middle span, a dip to the axis between samples, a circle arc stored as a spline, and the bulb turned, mirrored, and both. The first four fail without the change.
There was a problem hiding this comment.
🟡 Changes recommended
The orientation probe can select a knot span outside the curve domain and turn valid spline walls inward, and native-ellipse single-wall paths still lack coverage, including reversed arcs.
2 open issues
2 resolved since last review
Review effort: Balanced
Comment on lines
+1075
to
+1076
| None if matches!(curve, EdgeCurve::Ellipse(_) | EdgeCurve::NurbsCurve(_)) | ||
| && edge.start() != edge.end() |
…l's senses in it An unclamped spline's knots run on past its domain. The full turn read the wall's senses at the middle of its widest knot span, which can lie outside the domain, where the span's polynomial crosses the axis and the wall then faced in. The senses are now read only in spans of the domain. A profile spline is now clamped at the ends of its domain before a band or a wall is swept from it: the same curve, its ends its first and last control points. The ray cast reads an unclamped surface by a coarse grid of samples, and it read points inside the swept solid as outside. Tests: two unclamped degree-1 splines, whole and part turns, fail without the change. The bulb's arc as a native ellipse, stored either way and run forward or backward, sweeps one wall in whole and part turns.
…nding by span Clamping cut at an end whose knot already repeated up to the degree, and read a -0.0 end knot as unclamped, so revolve failed on such splines. An end whose knot repeats that often is now clamped without a cut. The full turn read a spline edge's winding from three points of its whole domain. A spline with its shape in a small part of that domain came out inside out. It now takes eight points per knot span, in the order the edge is used.
| fn clamped(curve: &NurbsCurve) -> Result<NurbsCurve, brepkit_math::MathError> { | ||
| let p = curve.degree(); | ||
| let (d0, d1) = curve.domain(); | ||
| let eps = 1e-12 * (d1 - d0); |
Clamping counted knots within 1e-12 of the domain as repeats of its end, so a spline with a 1e-13 span next to an end lost that span and the leg it held. It now counts them as `curve_split` does, closer than 1e-15.
Comment on lines
+2468
to
+2471
| let profile = profile_band_curve( | ||
| &profile_curve, | ||
| fwd_seg, | ||
| (p0_start, p1_start), |
andymai
added a commit
to Robokan/brepkit
that referenced
this pull request
Nov 30, 2026
andymai#2940 landed as a squash commit. For each conflicted file, main's changes since andymai#2940's head are replayed onto this branch's version.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Summary
A revolve of a profile with an ellipse or B-spline edge among lines built every face once per quarter turn. A full turn's flat top came back as four quarter discs and each side wall as four quarter faces. A part turn split the same way. The volume was right but the topology wasn't: a reference kernel gives one face per profile edge.
Full turn (
revolve an ellipse or spline arc as one wall per turn): the analytic full-turn path now takes an ellipse or spline edge. Its ends must be off the axis, and the hull of its control points must show the whole span clear of the axis. A circle arc stored as a spline keeps the old path, which sweeps an exact sphere. The new path sweeps the edge as one rational B-spline wall round the nine-point circle, with the edge as its seam.Directions and neighbours: the path reads the wall's directions at the middle of a knot span inside the curve's domain. So a spline that turns at a knot still faces out. The path also clamps a profile spline to its domain before it sweeps a band or a wall. This does not change the curve on its domain.
To judge the profile's direction, the path takes eight points on each knot span of a spline. The lines and circles beside it keep their exact planes, cylinders, cones and tori.
unify_faces_keepingkeeps a part turn's caps as faces of their own.Part turn (
a part turn of an ellipse or spline edge sweeps one wall): such an edge's wall is now one surface with a rational span per quarter turn (curve_revolution_spans). The edge at each end and every quarter's rim arcs bound it. Its first span is the band thatcurve_revolution_surfacebuilt, so the face's sense stays the same. An edge with an end on the axis, or not shown clear of it, keeps its wedges.Tests
crates/operations/tests/revolve_spline_edge_faces.rsrevolves a profile of lines with an elliptic arc, written as the rational B-spline a reference kernel writes for it. It runs a full turn and part turns of 90, 126, 180, 270 and 342 degrees, and asserts:The first two tests fail on
main: the full turn gives 20 faces where 5 are wanted, and a quarter turn 12 where 7 are. Another test checks that a half ellipse closed along its axis revolves to the exact ellipsoid volume.More tests cover:
-0.0end knot;Limit: a part turn of that last spline still comes out inside out, as on
main. Part turns find the profile's direction withmain's three-point sample, which this PR does not change. Onmain, its full turn is inside out too.revolve::tests::revolve_square_half_circlenow expects 5 faces for a half turn of a square, one per side plus the two caps.🤖 Generated with Claude Code