Repository navigation
Fix projection hang, parser panic, nondeterminism and sphere faces (ENG-3712) - #22
Conversation
When the incumbent is the pole of a collapsed edge, every patch along that edge reaches it, so certifying one projection examined millions of patches: a 4x3 NURBS face on an FMC connector took minutes. Settle for the incumbent after 65536 patches, twice the most any ordinary query in the board corpus examines. Amp-Thread-ID: https://ampcode.com/threads/T-01a12192-0f95-7657-bde4-754232566545 Co-authored-by: Amp <amp@ampcode.com>
Some exporters write four-component directions, which panicked the parser and lost the whole model. Keep the first items, as OCCT does. Amp-Thread-ID: https://ampcode.com/threads/T-01a12192-0f95-7657-bde4-754232566545 Co-authored-by: Amp <amp@ampcode.com>
Sample every edge of a shell up front, so faces sharing an edge still share its points, then mesh the faces on the rayon pool and merge them in face order. Shapes and their copies were meshed in hash map order, and colour groups of equal size were emitted in hash map order, so output changed from run to run. Sort shapes by entity id, copies by transform, and colour groups by size, then colour. Amp-Thread-ID: https://ampcode.com/threads/T-01a12192-0f95-7657-bde4-754232566545 Co-authored-by: Amp <amp@ampcode.com>
BGA solder balls are whole spheres bounded only by a vertex loop at the pole, which no chart covers, so every ball failed to tessellate. Mesh them as rings of latitude between two poles within the tolerance. Amp-Thread-ID: https://ampcode.com/threads/T-01a12192-0f95-7657-bde4-754232566545 Co-authored-by: Amp <amp@ampcode.com>
|
Verification (orb, 16 threads,
Board corpus: all 893 distinct embedded models from the 619 boards, of which 885 are STEP (8 are WRL). Each model ran in its own process with a 300 s timeout and an 8 GB address-space limit. The canonical mesh hash is the sorted set of triangles with colours.
Tests: |
There was a problem hiding this comment.
Not approved: this is a functional tessellation and mesh-output change, not a small fixup, so human review is required. Cursor Security Agent passed with no findings; Cursor Bugbot was not present. Human review is needed and no reviewers were assigned.
Sent by Cursor Approval Agent: Pull Request Router and Approver
Picks up the projection, parser, determinism and sphere fixes from diodeinc/foxtrot#22 (ENG-3712).
* refactor(step): build a public scene that the STEP writer consumes Split `pcb_step::export` into `Scene::build`, which turns a board into body solids, copper, silkscreen and solder mask faces and model placements, and the STEP writer that consumes it, so other formats can export the same assembly. STEP output is byte-identical on every board in the DiodeHub corpus that exported before. Move the `pcb step export` command line into `pcb_step::cli` behind a `cli` feature so other exporters take the same arguments. * feat(gltf): add pcb gltf export Write a GLB for a KiCad board without kicad-cli. The board side comes from the pcb-step scene: prisms become caps and walls, round holes are revolved from their profiles, and flat faces are triangulated with i_triangle. Each distinct embedded STEP model is tessellated once with foxtrot and placed by a node per footprint. Takes the same arguments as `pcb step export`. * chore(deps): bump foxtrot to 34b2d05 Picks up the projection, parser, determinism and sphere fixes from diodeinc/foxtrot#22 (ENG-3712). * fix(gltf): write exports atomically and reject empty ones Replace the hand-rolled .part staging with atomicwrites, so an output named like the staging file is no longer truncated and deleted when an export fails. Reject a GLB with no board or components as STEP does. * fix(gltf): print export warnings when the export fails Exporters now add warnings to a report the command owns, so a failure such as every model failing to load still names the models.


This change fixes four tessellation defects that the board corpus finds (ENG-3712). NURBS projection stops after 65536 patches near a collapsed edge, the parser keeps the first items of an over-long bounded list, shapes and colour groups come out in a fixed order while shell faces mesh in parallel, and whole spheres bounded by a vertex loop mesh as rings of latitude. Of 885 corpus STEP models, 877 give the same mesh as master, 7 change only because they now tessellate with no failed faces, and one times out on both.