Files
jyviko e9e568adbd solidcore-ops: turn a sheet over (reverse its faces) (#15919)
* solidcore-ops: a sheet turned over, each face reversed in its shell, the record reading the other way

`surface::reverse_sheet(sheet)` takes a sheet record, reverses each face with the kernel's
`flip_face_orientation` (the face's other use made the upward one, each loop's other loop use its
primary) and gives the record back: each face's `forward` in its shell negated, its surface,
domain, loops and edges as they were, so edges stay shared. A closed body is refused
(Unsupported): turned over it would be inside out.

Tests: each face's shell normal at the same (u, v) is negated (the natural normal turned by
`forward`); the turned record round-trips through the kernel; turned twice gives the record back;
a box is refused.
Not built or run locally (CI is the check).

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

* Sheet reverse: rustfmt

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

* Sheet reverse: each loop runs the other way round; the surfaces and domains are what is kept

The kernel's flip_face_orientation makes each loop's other loop use primary, so the record's
loops come back reversed (edge order, each edge's forward, the pcurves as the kernel gives them),
not as they were. The doc says so, and the test asserts each face's surface, NURBS form and domain
kept and each loop the same cycle of edges run backwards, each used the other way.
Not built or run locally (CI is the check).

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

* Sheet reverse: rustfmt

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

* Sheet reverse test: the rotation taken before the rotate (E0502: the slice borrowed mutably while its length is read)

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

* solidcore: a face of a sheet turned over, and a sheet turned over whole

`topology::face::p1::turn_over(b, f)` makes the mate of the face's upward use the upward one
and each loop's other loop use its primary, keeping each use's orientation, loop uses and edge
uses: the face's side against its surface (the upward use's orientation) is the other one, and
each use is as consistent as it was, so a valid face stays valid. Turning over twice gives the
face back exactly. `flip_face_orientation` (the upstream repair, which rewrites the two
orientations and so keeps the side) now shares the swap with it. A face whose uses lie in two
shells is refused: its side is its material's.

`topology::brep::sheet::turn_over_shell(b, s)` turns every face of an open shell over;
`turn_over_sheet(b)` every shell of faces of a body. A closed shell is refused (Unsupported)
before anything changes: turned over, the body would be inside out.

Tests (tests/face_turn_over.rs): a rectangle sheet turned over is valid, its upward use is
Opposite and its normal in that use's sense (`face_normal_at_edge`, the sense `point_side`
reads) is negated at each edge; turned over twice (by face and by shell) its faces' upward
uses, loops and uses are as they were; a box is refused by sheet and by shell, its face by
`turn_over`, and is unchanged.
Not built or run locally (CI is the check).

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

* solidcore-convert: a sheet's face reads as its upward use, both ways

`to_record` kept the `same` use of each face of a sheet, so a sheet turned over
(`topology::face::p1::turn_over`) read as before. It now keeps the upward use, the side the face
is turned to: the record face's `forward` is negated, its surface, domain, loops and edges as
they were. Every face the kernel builds has its upward use along its surface, so for a sheet
not turned over the upward use is the `same` one and the record is as before.

`to_kernel` built every sheet face with its upward use along its surface, whatever its record
shell's `forward` said (the kernel's data carries no upward use), so a face its sheet uses
backward came back facing the other way. Each such face is now turned over once built
(`turn_sheets_over`), and the record goes round. Closed shells are as before.

Tests (tests/turn_over.rs): a rectangle sheet goes round byte for byte, built facing as its
record says; turned over, its record has the same faces, edges and vertices with each face's
`forward` negated, builds a body turned over in the kernel too that gives the same record byte
for byte, and turned over again gives the first record byte for byte.
Not built or run locally (CI is the check).

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

* solidcore-ops: Body::turn_over, a sheet turned over by the kernel

`Body::turn_over()` calls the kernel's `turn_over_sheet` on the body (no geometry in ops): each
face's side the other way, its surface, loops and edges as they were, so its record reads each
face backward in its shell. A body with a closed shell is refused (Unsupported) and left as it
was.

Tests: ops (tests/turn_over.rs) a bumped ruled sheet turned over has the same faces, edges and
vertices with each face's `forward` negated, and its record goes round the kernel unchanged;
turned over twice it is the sheet again; a box is refused and its record unchanged. tess
(tests/turn_over.rs) the turned sheet meshes as the same points with each normal negated and each
triangle wound the other way, counter-clockwise about its normal before and after.
Not built or run locally (CI is the check).

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

* solidcore-tess: turn-over test, rustfmt

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

* solidcore-ops: reverse_sheet turns the sheet over with Body::turn_over

`surface::reverse_sheet` flipped each face with `flip_face_orientation`, a repair that keeps the
face's side, and checked for a closed body itself. It now calls `Body::turn_over` (the kernel's
`turn_over_sheet`, which refuses a closed shell), and has no code of its own for the job. The
record of the turned sheet keeps each face's surface, domain and loops and the edges; each
face's `forward` in its shell is negated.

Test: each face's `forward` is negated and its shell normal is negated at three points of its
domain, the faces and edges as they were (the loops are no longer reversed); the round trip,
twice-is-identity and closed-body tests are kept.
Not built or run locally (CI is the check).

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

* Revert "solidcore-convert: a sheet's face reads as its upward use, both ways"

This reverts commit 741a297003. A valid kernel face's upward use is always its Same one
(`ValidatePointers` test 14), so the "keep the upward use" rule never differs from the old
"keep the Same use"; and the `to_kernel` half turned over every sheet face its record uses
backward, which the old path already reproduced: the corpus body
cov-match-raised-sheet-down-onto-the-edge-g1:b1 (a spline sheet used `forward: false`) came back
turned and renumbered (flat_parity). The converter is main's again; the corpus is untouched.
The turn-over moves to `SmFace::SwapUV` in the next commit, which keeps the upward use Same.
Not built or run locally (CI is the check).

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

* solidcore: a face is turned over by SmFace::SwapUV, and flip_face_orientation is upstream's again

`turn_over` made the mate of the upward use the upward one, keeping the orientations: an upward
use that is Opposite, which the kernel's own check refuses ("Faceuse is SM_OT_SAME",
`ValidatePointers` test 14, and "Face Loop has bad orientation"). The kernel's turn-over is
`SmFace::SwapUV` (`face::p1::swap_uv`): it swaps the surface's u and v, so its natural normal is
the other way, mirrors the trims and makes the other uses primary with the orientations to match;
the upward use stays the Same one and a valid face stays valid. `turn_over(k, b, f)` is now
`swap_uv`, still refusing a face whose uses lie in two shells; `turn_over_shell` and
`turn_over_sheet` take the kernel and keep their closed-shell refusal (before anything changes).
They loop over `turn_over` rather than call `SmBrep::SwapUV` or `OrientSheetSurfaces(same =
false)`, which ignore a face's failed swap. `flip_face_orientation` is byte for byte upstream's
again (the shared helper is gone). Ops' `Body::turn_over` passes the kernel.

Tests (tests/face_turn_over.rs): the turned sheet is valid, its upward use still Same, its
normal in that use's sense negated at each edge; turned twice (by face and by shell) its uses,
loops and normals are back; a box is refused and unchanged.
Not built or run locally (CI is the check).

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

* solidcore-ops: Body::turn_over returns the turned record and where each record edge went

The record numbers edges by its canonical walk, which a turned face's loops take the other way
round (docs/native-brep.md, "Canonical order"): a turn-over renumbers the edges, as operations
do, and picks and history follow through the operation's map. `Body::turn_over(order)` now
returns `TurnedOver { record, order, edges }`, `edges[i]` the new record index of record edge
`i` of `order`: the kernel keeps every edge (SwapUV), so the map is a lookup, no maths.

Tests: ops (tests/turn_over.rs) the bumped ruled sheet turned over has its spline net transposed
bit for bit, its box swapped, each face used as it was and its shell normal negated at the same
points, each mapped edge the same curve, interval and ends, one to one, and goes round the kernel
unchanged; turned twice, each edge comes back to its own number and the faces and edges are the
sheet's; a quarter cylinder sheet (an extruded arc) keeps its cylinder label, its normal negated;
a box is refused and unchanged. tess (tests/turn_over.rs) the turned sheet's normals are negated
at every point both meshes have (the corners at least), it faces the other way overall, and every
triangle is wound counter-clockwise about its normal before and after.
Not built or run locally (CI is the check).

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

* solidcore-tess: turn-over test, rustfmt

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

* solidcore-ops: reverse_sheet returns the turned record and where each record edge went

`surface::reverse_sheet` is now `Body::turn_over(&order)` on the sheet's body (the kernel's
`SmFace::SwapUV` on each face) and returns `(record, edges)`: the turned record and, for each
record edge of the input, its index in it. The record numbers edges by its canonical walk, which
a turned face's loops take the other way round, and an application holds picks and history by
edge index, so the map goes with the record.

Test: each face used in its shell as it was, its box swapped and its spline net transposed bit
for bit, its shell normal negated at the same points; each edge the same curve, interval and ends
at the index the map gives, one to one; the round trip unchanged; turned twice, each edge back
at its own number and the faces and edges the sheet's; a box refused.
Not built or run locally (CI is the check).

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

* solidcore-tess: turn-over test, rustfmt as edition 2024

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

* solidcore-ops: the turned-cylinder test takes a sheet the record labels a cylinder

`a_turned_cylinder_sheet_keeps_its_label` failed on its first assertion: an extruded arc records
as its rational spline form, not a cylinder, so the test never reached the turn. The fixture is
now the kernel rig's own quarter cylinder sheet (surfaces/cov-extend-quarter-cylinder-along-its-
axis, body b2: radius 10 about z, 20 high, labelled `cylinder`), read from its corpus record and
written back by the converter, so the second assertion asks what it means to: does a turned
cylinder sheet keep its label.
Not built or run locally (CI is the check).

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

---------

Co-authored-by: jyviko <2501648+jyviko@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 10:16:42 +00:00
..