Skip to content

Drawings: a shaded view is drawn on the sheet as a picture under its lines (#5624) - #10926

Merged
bherbruck merged 15 commits into
tangency-labs:drawingsfrom
CamWight:drawing-shaded-paper-5624
Nov 3, 2026
Merged

bherbruck merged 15 commits into
tangency-labs:drawingsfrom
CamWight:drawing-shaded-paper-5624

Conversation

@CamWight

@CamWight CamWight commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

A drawing view set to shaded showed only its lines on the sheet. Now the sheet shows a shaded picture of the model under the view's lines, in exactly the same place. Export writes the picture into the SVG. The pictures below show the same sheet before, with lines only, and after, with the top view shaded.

Part of #5624 (W17b, shaded drawing views), into drawings: a shaded view's picture on paper (V9b). A view with display_style: shaded now reaches the sheet as a picture under its lines, and drawing.export writes it into the SVG.

Stacked on #10469 (with #10465, #10464 and #10363 under it, for how a sheet's pictures are written) and on #6483 and #10434 (the tile renderer, both into main). The earlier commits here are copies of those. This PR's own commits are the last three.

Since the last push

Rebased onto drawings 49a3ba1, which has WE1-WE5, B2a (#9708), F1-F4 and A5's dashed lines (#7430). Four things were merged by hand, each in the commit that needed it, and one test was added:

  • Balloons by id: the commit that keeps balloons in ById removed Drawing::balloon, and three callers that WE3-WE5 added still used it: has_object, the delete command and a drawing test. They now go through balloons, so every commit builds again.
  • WE2's scene check: the check of whether a sheet's last scene still holds compares the sheet's images too, through WE2's inputs. A change to an image draws the sheet again.
  • WE2's status test used shaded as the style that fails. V9b draws shaded, so the test now uses shaded_visible, which still waits for exact lines.
  • Formatting: assemble's signature as rustfmt writes it once the images commit adds its parameter.
  • The border's box (new test): a sheet's border is one object, and its box is measured before the images painted with it join it. A test now places an image off the border's corner and checks that the border's box is unchanged, so an image never widens what a sheet's commands pick as the border.

Changes a default: no

In crates/geom: nothing of its own. The copies of #10363 and #10469 under it add MAX_IMAGE_PIXELS and a SheetImage kind to paper.rs. It holds drawing data only, with no kernel geometry.

What it does

Pictures

From the real app on an AMD card, on a plain test plate: 100 x 80 x 20 mm with two bores, a top view at 1:2 and its two projected views, exported as SVG and rendered in Chrome.

Lines:

The plate's three views as lines on the sheet

The same sheet with the top view set to shaded:

The same three views shaded, the bores showing as holes

The projected views follow their parent's style. The export took 0.5 s, the same bytes came back twice, shaded_visible was refused with nothing written, and there were no crash files.

Tests

  • The picture lies on the view's lines: its rectangle to 1e-9 mm at both scales, and the pixels a full pixel each side of a wall.
  • Reference parts grow the picture and it stays on the lines, for the model's picture and the reference part's under it.
  • A lines-only reference hides the model and paints nothing.
  • The pictures for each style and hide setting.
  • Bands and tiles put together are the picture drawn whole, across a seam between tiles. A thin view wider than a render task is drawn.
  • A model edit changes the pixels. Hiding a body in the browser doesn't.
  • Edges are smoothed.
  • The export is the same bytes twice, follows the part's colour, and refuses a picture past the grid's limit with nothing written.

Validation

This push, local, Windows, --profile ci, on #11042's head e08543631 over drawings 49a3ba1c0: fmt, lists, i18n and clippy pass, and 755 tests pass (render 320, geom paper:: 36, doc drawing 57, engine drawing 310, io paper:: 32). On #10926's own head 7d03aebf6 the same tests pass (754: render 319). Each of the 16 commits builds on its own, all targets. Six planted faults are each caught by a test: a sheet's images left out of what is on it, images kept when their sheet goes, files kept after their last use, the border's box taking the images, the scene's inputs without the sheet's images, and a balloon that isn't an object on its sheet. The clean runs after them pass.

Earlier pushes:

This push, on 87af66193 over drawings d5fd14135: fmt; clippy -D warnings over render and engine, all targets; run on the row-spans commit above this head (ed131c110), which holds these commits: render's job tests, 111 passed, 0 failed, 1 ignored; engine's drawing picture, export, view and UI tests and registry_is_consistent, 93 passed, 0 failed. Three planted faults in the running sum were caught: a view's count kept as its last request's, a view refused at its limit, and the limit not applied. GPU device tests weren't run here.

The wider tests on this head itself (87af66193): render, all: 319 passed, 0 failed, 1 ignored. engine's cmd::render:: and drawing_ tests: 279 passed, 0 failed. io's paper:: tests: 27 passed, 0 failed.

The previous push, local, Windows, --profile ci, on 6762ff00d over drawings 85be50df0:

  • cargo fmt --check, xtask lists, xtask i18n --check; clippy -D warnings over geom, io, render and engine, all targets.
  • render's library tests: 318 passed, 0 failed, 1 ignored. engine's drawing tests: 204 passed, 0 failed.
  • 19 planted faults, each caught by a test. Three got past the first runs (the frame a pixel off, a depth-only body painted, one sample a pixel), which is why the wall, hole and smoothing checks above are there. The last clean run passed.

Full gate on the group's top, #11042's ed131c110 (this head with the row-spans commit above it), over drawings d5fd14135, on Windows with an RTX 5080: fmt, assets, icons, licences, lists, layers, ui-containers, clippy (workspace and egui), wasm and web offline pass; the tests of the 14 crates the change can reach (all but solidcraft-derive and the two 3D mouse crates): 10,438 passed, 0 failed, 70 ignored. Among them, solidcraft-gpu's library tests: 160 passed, 3 ignored, on Vulkan with the Intel driver turned off. The gate's summary doesn't say whether the GPU device tests found a device or skipped, so the GPU caveat stays. The robustness goldens were skipped: they fail on this PC, and CI runs them.

Integration status

Draft until what's under it lands, then rebased onto what's left. #5626 stays the claim for #5624. @0xlillith's acceptance cases on #5624 can start against this head.

Refs #5624, #860

@github-actions github-actions Bot added area:doc timeline, components, parameters, naming area:io import/export and file formats (STEP, IGES, 3MF, glTF, designs) area:kernel B-rep kernel, booleans, blends, STEP/IGES area:render GPU, viewport drawing, materials and the renderer labels Nov 2, 2026
@CamWight
CamWight force-pushed the drawing-shaded-paper-5624 branch from 6762ff0 to 87af661 Compare November 2, 2026 08:01
@CamWight
CamWight marked this pull request as ready for review November 2, 2026 14:42
@CamWight CamWight changed the title Drawing sheets: a shaded view's picture on paper (#5624) Drawing sheets W17b: a shaded view is drawn on the sheet as a picture under its lines (#5624) Nov 2, 2026
@CamWight CamWight changed the title Drawing sheets W17b: a shaded view is drawn on the sheet as a picture under its lines (#5624) Drawings: a shaded view is drawn on the sheet as a picture under its lines (#5624) Nov 3, 2026
CamWight and others added 14 commits November 3, 2026 12:23
…ngency-labs#5426)

Each kind on a sheet writes out the same add, find by halves, cap, order and check loop. ById holds
those, so a kind's own file holds only its own rules, and the file's bytes don't change: it saves as
the plain list. Views and dimensions stay on their own lists for now, since other work is on them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ngency-labs#5426 W38e-1)

images holds the files and sheet_images each place one sits, so a logo on every sheet costs what one
does. drawing.image.add reads the file (bytes and pixels checked from its header before anything
decodes it), reuses a file with the same bytes, and saves the bytes without the path. A file goes
with the last thing that uses it, which Drawing::images_in_use alone says, and reading a drawing
refuses a file nothing uses or a record its file disagrees with. A sheet's list and delete take the
placements on it. Deleting one placement waits for selection.delete to take a drawing's objects. Its
pixels on paper are W38e-2.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…#5425, W38e-2)

A PNG or JPEG decoded once, then stretched over its paper rectangle onto the pixel grid a writer
asks for: a box filter in linear light with alpha premultiplied, so a shrunk logo keeps its edges
and gains no dark fringe. The size is read from the header and refused over 64 megapixels before
anything is decoded. An EXIF orientation is applied; colour profiles are not read.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…labs#5425, W38e-2)

Each image placed on a sheet is a group of the new kind `sheet_image`, between the drawing border
and the views, so a view's lines draw over a photo. `drawing_pictures` holds both that group and
the provider a writer asks for its pixels, so the two read the same placement.

The provider holds what one sheet uses, decodes a file when it is first asked, once however many
placements show it, and refuses a sheet whose files hold more than 64 million pixels, from their
headers, before anything decodes. `drawing.export` passes it to the SVG writer in place of
`NoPictures`, and a file that won't decode refuses its sheet by name.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…angency-labs#5624, W17b S1)

The decoded rows of five product renders (orthographic on a transparent background, perspective on a
solid one, a PBR surface, two glass layers sorted back to front, triangles crossing every edge of the
picture), taken on this tree. The next change reshapes ImageTask into a prepare stage, tiles and a PNG
sink; they must not move. The PNG bytes are not pinned: their compression depends on the deflate
backend the build unifies (flate2's zlib-rs when the UI crate is built alongside, miniz_oxide
without), not on this code.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…abs#5624, W17b S1)

The CPU product renderer, reshaped so drawings can use it: one rasteriser (`Raster`) prepares a
scene once (appearances, projected triangles, glass sorted back to front), then draws each tile of
the picture on a canvas of its own. A sample's position comes from its whole-picture index, so tiles
put side by side are the picture drawn whole, to the byte.

- `ImageTask` (render.image) is that rasteriser over one whole-picture tile from the product camera,
  then its PNG: the same output, pinned by the previous commit's rows.
- `PictureTask` draws a `PictureRequest`: a `Projection` (the product camera, or an `OrthoFrame`,
  W17a's view frame as plain data: a `Plane` basis, a scale and a paper shift, on a
  `geom::pixel_grid::PixelGrid`), any list of `PixelWindow` tiles, `Supersample::One` (pixel centres)
  or `Two` (i + 1/4 and i + 3/4), a `BodyRole` per body (`DepthOnly` hides what lies behind it and
  draws nothing itself) and an optional background (none: transparent). Each tile comes back as
  straight-alpha sRGB RGBA rows, blended in linear light.
- The orthographic map is the frame's paper map, onto the grid, so lines drawn from the same frame
  register with the pixels (to 1e-9 mm in the test).
- Limits: 65,536 px a side, no total cap; each tile under the resolver's `RenderLimits`, as the
  product image is; at most 65,536 tiles; the prepared lists as a product image's; pixel tests up to
  8 per sample of the picture (128 M for a product image, as before), counted at admission by the
  one projection the raster uses, as main counts a product image's.

Not here: the drawing light, stored per-tile bins (S2, measured), the paper scene's picture item
(S3), 4x sampling, and `raster::render`, the snapshot rasteriser, which stays as it is.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An ignored timing test, as `simplify_timing` is: a 65,548-triangle front view drawn as the
product image, as one 300 dpi picture, and in 64-row strips at 300 and 1200 dpi, each the median
of three runs. It is the measure S2's speed-ups are judged by.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…angency-labs#5624, W17b S2)

Each tile placed and painted every triangle of the picture, then dropped those outside it: the
appearance lookup, the PBR normals and the colour decode ran for every triangle in every tile. A
triangle's work is now three steps, `corners`, `look` and `place`. Preparation runs them in
today's order, so its checks and errors are the same. A tile places a triangle first and paints
only those inside it. What is drawn doesn't change: the pin and the tile tests stay as they were.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`raster::shade` normalised its key light and highlight directions again for every sample,
although both depend only on the view. `raster::Light` works them out once per view and shades
with them. The tile renderer and the snapshot rasteriser (`raster::render`) both use it, so the
product light is written in one place. The arithmetic is the same, so every pixel is too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Each shaded sample was stored as sRGB through a power (three per sample), and each output pixel
was averaged from its samples through twelve more and written back through three: the powers
were most of a sample's arithmetic. Decoding is now a 256-entry table of `geom::srgb`'s own
values (tangency-labs#7162), which also ends this file's own copy of the formula. Encoding counts the code
starts (the linear values halfway, in sRGB, between two codes) at or below the value. Within a
billionth of a start, where the formula's rounding could fall either way, `srgb::encode8`
decides, so every code is the one it gives. A test checks both against `geom::srgb` at every
start, the numbers around it, the band's edges and a million values in and outside 0 to 1.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The raster went back through its step loop for every sample: the cancel check, the stage match,
the tile's window and its canvas bounds, once per sample cleared, tested or averaged. Clearing,
the opaque and glass passes and the downsample now each loop on their own up to the step's budget,
counting a unit as before; preparation and the glass sort still take one unit a call. A step
still checks for cancellation before each stage's run and still does at most 16384 units, so the
host's slices and the progress counts are the same.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…gency-labs#5624, W17b S2)

Three planted faults went through the image tests; each now has one
that fails:
- an orthographic picture lit from another direction than its eye: a
  face square-on to the view is the colour the product image gives it;
- glass placed by a triangle's first corner, not its middle: a tilted
  square whose first corners lie in front of the near one, its middles
  behind;
- a picture held to the product image's pixel-test budget: a face
  across most of an A0 sheet at 1200 dpi is prepared.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… W17 V9b)

A saved view in a shaded style draws on its sheet and in drawing.export:
draw puts one picture per entry of the view's parts under its lines, and
ViewPictures renders each on the writer's grid through the frame that
placed the lines. SheetPictures answers for a sheet's images and views.
The styles with lines stay refused until W06's exact lines.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…cy-labs#6483 has them (tangency-labs#5624)

A triangle counts only where it meets the tiles asked for, and a picture has a fixed 400 M pixel tests,
as tangency-labs#6483 at bf93e890e. V9b's stack holds an older copy of that slice; this drops away when drawings
takes main. PictureTask says what admission counted, for the view's running sum.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…-labs#5624, W17 V9b)

A writer asks for a picture a band at a time, and each request is limited on its own, so ViewPictures
keeps what each view's requests have counted and refuses the next one past the limit, by name, before it
paints. That makes 400 M a bound on a whole view.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@CamWight
CamWight force-pushed the drawing-shaded-paper-5624 branch from 87af661 to 7d03aeb Compare November 3, 2026 13:14
@bherbruck
bherbruck merged commit cca77b1 into tangency-labs:drawings Nov 3, 2026
23 of 25 checks passed
CamWight added a commit to CamWight/solidcraft that referenced this pull request Nov 17, 2026
…ene (tangency-labs#4890 P1)

The sheet PDF writer and @0xlillith's layer, budget and flat-output work,
replayed onto drawings 8a0b1fd. What the replayed commits couldn't hold:

- Geometry only, as before: the scene's text runs (B1b, B2a) and pictures
  (tangency-labs#10926) are passed over; text follows with P2. A group with no stroke or
  fill puts no mark on the page, so it invents no layer and doesn't break a
  run of one kind (`painted`, the one test the layers and the content share).
- Seg2 and Vec2 come from solidcore-record and the vector maths from the
  geom prelude (tangency-labs#11496).
- The tests build scenes with Scene::new (scenes now carry fonts and clips).

Line widths need nothing: the walk already gives each stroke its kind's and
line group's width (tangency-labs#12232). The replayed commits keep their resolutions:
the io paper module keeps PaperColour beside push_mm, and the PDF fuzz test
is built like the SVG and PNG ones, on seed 0x5a7 (0x5a5 is the clip test's).

Test change: flat_pdf_reproduces_the_original_p1_a3_sample_bytes pinned the
whole file, and its Info dictionary names the build ("SolidCraft 0.19.0" then,
0.41.0 now). The same file with 0.19.0 put back has the old SHA-256, so the
drawing's bytes are unchanged. The pin is now the 721 bytes before the Info
dictionary, and the Producer is checked against this build's version, so a
release bump no longer moves it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
bherbruck pushed a commit that referenced this pull request Nov 17, 2026
… point for the PDF work (#4890) (#7626)

* io: the date rule crash reports use, for other writers too (#4890 P1)

civil (seconds since 1970 to a UTC year, month, day, hour, minute and second)
moves from engine::crash down to solidcraft_io, unchanged, so sheet PDFs can
write their dates by the same rule. Crash reports call it from there.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Paper scene: a sheet as a vector PDF, geometry only (#4890 P1)

A new writer, io::paper::paper_pdf, beside paper_svg and paper_png, reading
the same walk: one page the sheet's size, its lines, arcs, cubics, parabolas,
fills and dashes. Text follows with P2.

- The file comes from pdf-writer 0.15 (MIT OR Apache-2.0; brings ryu): a
  catalog, one page whose MediaBox is the sheet in points, the content
  deflated with flate2 (already in the tree through zip), and an Info
  dictionary: Producer "SolidCraft <version>", the Title when one is given,
  and CreationDate/ModDate only from PdfOptions::output_time (UTC), never the
  clock, so a scene always gives the same bytes. ISO 32000-1 14.3.3: unknown
  entries are left out, not written empty.
- Numbers: the walk runs on a 10 nm grid (Grid::TEN_NANOMETRES), written as
  millimetres with up to five decimals (Annex C's precision) inside one
  `2.834645669 0 0 2.834645669 0 0 cm`; y is up in both, so nothing flips. The
  SVG writer's number rule moves to io::paper::push_mm, taking the decimals.
- Arcs: each of the walk's quarter-turn pieces is cut into as many 4/3 tan(t/4)
  cubics as keep it within 1e-4 mm, the rounding of control points onto the
  grid included (one cubic a quarter turn would be 2.7e-4 r off). The arc's
  centre comes from Piece::seg, the rule the flattener used, moved onto Piece
  so both read it. Parabolas are raised to cubics.
- Paint: w at the walked width (never 0: 8.4.3.2 says 0 is a device pixel),
  0 J 0 j 4 M as SVG and PNG, d for A5's dashes, each set only when it changes;
  closed outlines `s`, fills even-odd `f*`.
- Refused: a page under 3 pt a side (Annex C), a title over 1,000 characters,
  a date past 9999.
- Dates use io::civil, the crash reports' rule (moved in the commit below).

Tests: the A3 MediaBox; 50 mm on paper is 141.732 pt; the same bytes twice,
dates only from output_time (2000-02-29 and 9999-12-31 23:59:59); every xref
entry at its object; arcs from 0.5 mm to 2 m radius within 1e-4 mm and a
parabola on its cubic, every number at most five decimals; widths, dashes,
closes and fills as the other writers paint them; the refusals. One fuzz scene
now feeds the SVG, PNG and PDF mutation tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(pdf): validate byte offsets and separate page-scale precision

Continue the P1 handoff in #7626 with original commits preserved. Only the existing PDF test module changes. Complete IO library 153/0/2 existing ignored, scoped strict Clippy and wasm pass. Full workspace gate remains unqualified on the limited-memory drawings receiver; see PR evidence.

* fix(pdf): enforce the content budget before buffer growth

Continue P1 in #7626. Four regressions reproduce the previous late-check policy using tightened limits; six budget tests pass with all 159 IO library tests, scoped strict Clippy and wasm. Original A3 output bytes unchanged. The limited-memory full-workspace gate remains explicitly unqualified; no CI changes.

* feat(pdf): group paper objects into optional layers

Continue the existing #7626 handoff with five ordered default-visible optional-content groups, bounded marked content, paint order and style preservation. Original implementation and earlier tests retained; an original five-kind repeated-group fixture adds independent structure and PDFium visibility acceptance.

Focused validation: complete IO 162 passed, 0 failed, 2 existing ignored; all18 PDF cases, strict IO Clippy and wasm passed. Exact native build artifact reused after a preserved private runner drain failure. Full cargo xtask ci, Drawing UI and print acceptance remain unrun; this is saved draft work, not a ready/merge claim.

* feat(pdf): support flat vector output without optional layers

Preserve default layered output and vector paint. Original acceptance covers flat metadata, exact content limits, empty groups and the original 1063-byte A3 pin. Complete IO165/0/2 existing ignored, all21 PDF cases, strict Clippy, wasm and independent five-layer/flat raster checks passed on unchanged final source. An earlier new-test metadata indentation failure is preserved separately and corrected with stricter raw-byte metadata assertions. Full workspace CI and editor/print qualification remain outstanding; saved draft increment in #7626.

* perf(pdf): coalesce adjacent optional-content runs

* Paper PDF: rebased onto drawings, the writer against today's paper scene (#4890 P1)

The sheet PDF writer and @0xlillith's layer, budget and flat-output work,
replayed onto drawings 8a0b1fd. What the replayed commits couldn't hold:

- Geometry only, as before: the scene's text runs (B1b, B2a) and pictures
  (#10926) are passed over; text follows with P2. A group with no stroke or
  fill puts no mark on the page, so it invents no layer and doesn't break a
  run of one kind (`painted`, the one test the layers and the content share).
- Seg2 and Vec2 come from solidcore-record and the vector maths from the
  geom prelude (#11496).
- The tests build scenes with Scene::new (scenes now carry fonts and clips).

Line widths need nothing: the walk already gives each stroke its kind's and
line group's width (#12232). The replayed commits keep their resolutions:
the io paper module keeps PaperColour beside push_mm, and the PDF fuzz test
is built like the SVG and PNG ones, on seed 0x5a7 (0x5a5 is the clip test's).

Test change: flat_pdf_reproduces_the_original_p1_a3_sample_bytes pinned the
whole file, and its Info dictionary names the build ("SolidCraft 0.19.0" then,
0.41.0 now). The same file with 0.19.0 put back has the old SHA-256, so the
drawing's bytes are unchanged. The pin is now the 721 bytes before the Info
dictionary, and the Producer is checked against this build's version, so a
release bump no longer moves it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Paper PDF: an arc piece a little over a quarter turn is written, not refused (#4890 P1)

A drilled plate's iso view failed the sheet PDF with "an arc needs too many cubics", while its SVG
and PNG were fine. The walk's arc pieces are about a quarter turn, but can turn a little more: their
ends are rounded onto the 10 nm grid, and a sliver piece merges into the next. cubics_for refused
anything past a quarter turn plus 1e-9.

cubics_for now takes up to a half turn, and starts from enough cubics that each spans at most a
quarter turn. Any arc it wrote before starts at one cubic as before, so it writes the same bytes:
the byte pins pass unchanged. Piece::Arc's doc says what the walk gives (a comment change only in
geom). The scene caps a sweep at a whole turn plus 1e-12, so the walk's four-piece cap adds
nothing past the old slack.

Found by @DevonHope on #9647, with this fix and its unit test
(an_arc_a_little_over_a_quarter_turn_is_written). The second test walks Ø16 circles at nearby
centres until one gives a piece past a quarter turn, then writes each and checks every cubic lies
on the circle.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Paper PDF: the flattener and a grid piece's curve move into io, beside the PNG and PDF writers that use them (#4890 P1)

geom's paper module only shrinks (CONTRIBUTING). Its flattener had one caller, io's PNG
writer, and the stack had added `Piece::seg`, `GridPoint::vec` and a 10 nm grid constant
to geom for io's PDF writer. They now live in io/src/paper/flatten.rs, with the
flattener's tests unchanged except one call form: `flatten`, `seg` (a piece's curve,
which both writers read) and `vec`. The PDF writer makes its own 10 nm grid with
`Grid::new`. Nothing writes different bytes: the PNG and PDF byte pins pass as they were.

geom's walk test for an ellipse's cubics checked them by flattening them. It now samples
each cubic itself, with the same bound, so geom's test needs no io.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Paper PDF: each writer's grid and its number text are one decimals value, and io lists the grids (#4890 P1)

A paper writer's precision was two facts that had to agree: PDF kept PER_MM and
DECIMALS, SVG kept the nanometre grid and its six decimals, and PNG named the
nanometre grid too. Now io/src/paper.rs holds one Decimals value for each: whole
nanometres (SVG's numbers, PNG's grid) and 10 nm (PDF's). Each gives the writer
its grid and writes its numbers.

io lists the writers' grids (writer_grids). The engine's hatch-dot check in
drawing_scene/fill.rs, from @0xlillith's saved fills, loops over that list instead
of keeping its own copy of the PDF grid, so a new writer's grid reaches it too.

Docs: the flattener's notes no longer say PDF flattens curves, and its cap is
MAX_PATH_POINTS, apart from the PNG writer's MAX_POINTS. Two geom doc comments
(grid.rs, cubic_pieces.rs) say what the code does, in the same number of lines,
and the xref check's comment says what its bound is. No bytes change: the PDF and
SVG byte pins pass as they were.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: lillith <35337584+0xlillith@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:doc timeline, components, parameters, naming area:io import/export and file formats (STEP, IGES, 3MF, glTF, designs) area:kernel B-rep kernel, booleans, blends, STEP/IGES area:render GPU, viewport drawing, materials and the renderer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants