Repository navigation
Conversation
CamWight
force-pushed
the
paper-clip-4890-a8b
branch
from
November 1, 2026 05:53
732a817 to
09ea1e9
Compare
CamWight
force-pushed
the
paper-clip-4890-a8b
branch
from
November 2, 2026 03:05
09ea1e9 to
41e868f
Compare
CamWight
force-pushed
the
paper-clip-4890-a8b
branch
from
November 2, 2026 23:34
41e868f to
00de7a8
Compare
CamWight
marked this pull request as ready for review
November 2, 2026 23:36
CamWight
force-pushed
the
paper-clip-4890-a8b
branch
from
November 3, 2026 11:46
00de7a8 to
d50f548
Compare
…angency-labs#4890 A8a) Scene::prepare_clipped(clips) cuts each group of an object to that object's Clip, a rectangle or a circle (a detail view's), and keeps what lies inside; prepare() is prepare_clipped with none. Prepared holds a Cow: a scene without clips is borrowed as it is, and Group and Scene are unchanged, so today's scenes are the same bytes. - Lines and arcs are cut where they cross the edge; a part is kept when its middle is inside, the edge included. Parts no longer than EPS go. - Kept parts that follow one another stay one open stroke. A stroke wholly inside is kept whole, closed if it was; a closed one cut open rejoins across its seam. - A dashed stroke keeps its pattern: each part's phase is where it starts along the stroke. Across a closed one's seam the pattern runs on only when its length is whole patterns, so the parts rejoin only then. - Checked: one clip an object, a rectangle from its lower-left to its upper-right corner or a circle with a radius above 0, within 1e5 mm; a clipped object's items strokes of lines and arcs. What the cuts made is validated again. SVG and PNG draw the cut scene through Prepared as they are. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…angency-labs#4890 A8b) A clipped object's strokes may now hold any curve, not only lines and arcs, and its fills are checked against the clip. - A line or an arc is still cut where its equation says. Any other curve is halved while its control points lie either side of the edge (widened by EPS), until they span at most CUT_MM (1e-9 mm), and is cut there. A curve that needs more than MAX_HALVINGS halvings (one that runs this close along the edge) is refused as not supported yet. Each part is the same kind of curve as the whole. - Seg2::part gives the piece between two parameters, starting and ending exactly where split_at puts those points; a conic's tail is re-normalised, so its second parameter is carried into it. Seg2::MIN_SPLIT names split_at's distance from the ends. - A line or a circle within EPS of touching a circle only touches it: one cut there, never a sliver of chord. - A fill wholly inside its clip is kept and one wholly outside is dropped. One that crosses the edge, or lies round the whole clip, is refused as not supported yet. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CamWight
force-pushed
the
paper-clip-4890-a8b
branch
from
November 3, 2026 12:52
d50f548 to
4e845f8
Compare
Contributor
Author
|
Closing: this work landed in drawings inside #10969, merged with it at 12:58. |
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.
Only lines and arcs could be cut to a boundary, such as a detail view's circle, so other curves inside one were refused. Now any curve is cut where it crosses the boundary, and a filled area wholly inside is kept and one wholly outside is dropped. A fill that crosses the boundary is still refused, by name.
Part of #4890 (W10, the paper scene), into
drawings: clips of every curve, and fills kept or dropped whole (A8b). Stacked on #9833 (A8a, clips of lines and arcs). The commits before the last are the stack's; this PR's own is the last.Changes a default: no
In
crates/geom:paper/clip.rscuts every curve and keeps or drops fills whole.profile.rsgainsSeg2::part, a piece of any 2D segment, with a test intests.rs. The rest is tests. These modules hold drawing data only, with no kernel geometry.What it does
A clipped object's strokes may now hold any curve, not only lines and arcs, and its fills are checked against the clip.
EPS), until they span at mostCUT_MM(1e-9 mm), and is cut there. A curve that would need more thanMAX_HALVINGShalvings, one that runs that close along the edge, is refused as not supported yet. Each part is the same kind of curve as the whole.Seg2::partgives the piece between two parameters, starting and ending exactly wheresplit_atputs those points. A conic's tail is re-normalised, so its second parameter is carried into it.Seg2::MIN_SPLITnamessplit_at's distance from the ends. The clip's own copy ofpartgoes.EPSof touching the edge, on either side, only touches it: one cut there. So there's never a sliver of chord, and never a piece outside kept whole because its middle is on the edge.EPS, counts as either side: a fill beside the clip is dropped, and one that is the clip's own outline is kept. One that crosses the edge, or lies round the whole clip, is refused as not supported yet.(#4890 A8).Pictures
No view draws a clip yet: detail views will be the first. So this picture comes from the SVG writer itself, the same path a sheet export takes. One sheet holds the same object three times: as drawn, cut to a detail view's circle, and cut to a rectangle. Each boundary is drawn thin and dashed in a group of its own, which isn't clipped. The SVG was rendered to PNG in Chrome.
The object is a square outline, two parabolas, two cubics (one dashed) and two fills. Parabolas and cubics are the curves the SVG writer takes before A3b (#9846). Each curve is cut where it crosses the edge. The fill in the middle lies inside both clips and is kept. The one at the top left lies outside both and is dropped.
Tests
EPS: a touch, no chord.EPSand twoEPSeither side; zigzags 10°, 50° and 80° off its normal, open and closed; lines along it, through a corner and tangent to it; arcs touching it from either side and one round a circle clip; pieces from 0.1 µm to 3 mm; every other one dashed. Each is cut without refusal, 64 points a kept piece lie inside, every point well inside is drawn, nothing grows and the dash pattern stays. Squares on the edge, either side, are kept or dropped whole, and a fill that is the clip is kept.Seg2::partends where the whole is, for every kind, a conic's tail included.On this head
Re-parented onto
drawings49a3ba1c0(#7430 landed) as4e845f8d3. The landed tree is byte for byte our A5 commit's, so every commit of the stack keeps its tree and the checks below, run ond50f548c2, hold unchanged.d50f548c2overdrawingsd78895de4, local, Windows,--profile ci:-D warningsovergeom,ioandengine, all targets, pass;112e0a3d9an hour before:geom's library tests (A5 355, A8a 366, A8b 371, A8c 372) andio's paper tests (34, 34, 34, 38) pass, and on the topxtask lists,xtask layersandxtask wasm. The move tod78895de4changed one engine test line (below);d0550d9c2, overd78895de4:geom's library tests (372),io's paper tests (38) andengine's drawing and paper tests (199 + 2) pass;The planted faults of earlier rounds weren't rerun.
No full gate on this head.
What this rebase changed:
drawingsmoved fromd5fd14135tod78895de4(#10515, #7745, #10516, #11350, #11047, #9708, #11352). The stack's commits apply as they were. A review of the stack asked for the shapes-at-the-edge test above. It found two faults, both fixed here:EPS) had no cut, so its middle, on the edge, kept all of it, its far-outside ends included. A touch withinEPSeither side is now one cut, for lines on circles, arcs on rectangles and arcs on circles.Each fails its test without the fix.
Integration status
Lands after #9833 (#7430 has landed). #4891 stays the claim for #4890.