Skip to content

fix(research): a plane face whose ring visits a vertex twice is split there and meshed again when its triangles miss its area, and 21 toilets of Snowdon Towers Architectural are drawn from their saved meshes (#1732) (RE-434) - #1740

Merged
DrunkOnJava merged 5 commits into
mainfrom
fix/1732-pinched-plane-rings
Nov 11, 2026

Conversation

@DrunkOnJava

@DrunkOnJava DrunkOnJava commented Nov 11, 2026 •

Copy link
Copy Markdown
Owner

Summary

A plane face's outline can be one ring that visits a vertex twice (two lobes that touch at a point), which earcut covers a sliver beside, so its triangles add up to 0.65% more than the ring's area and the face is refused for triangulated area mismatch. When that check fails, the rings are split at every vertex a ring visits twice and the face is triangulated again; if the check then passes, the face is drawn from the split rings, else it is refused as before. A face that passes the check takes the path it always took, so no element that is drawn can change.

What moves (Measure, 126 exports against main: 125 identical, 1 differs): 21 IfcSanitaryTerminal of Snowdon Towers Architectural, one type (Toilet-Domestic-3D), change BodySource from partition_element_record_bbox to saved_graphics_mesh; body_sources moves 492 to 471 and 4,282 to 4,303, saved_mesh_refusals loses triangulated area mismatch 21 to 0 (269 to 248 entries). The model's triangles from saved graphics go from 6,228,638 to 6,948,098 (34,260 per toilet, where Revit's has 1,668, #1737) and its IFC from 269.5 to 296.3 MB (+9.9%).

Motivation

#1732, found by RE-430's run: the 21 toilets were behind a ruled-face refusal until #1715 let them reach this plane face. The diagnostic (a scratch build, runs 43054812102 and 43055872726) names the face and the cause.

Changes

  • plane_mesh (the planar triangulation, moved unchanged) and split_pinched_rings (src/research/native_saved_mesh.rs); five failure-first tests of the pure helper.
  • reports/element-framing/RE-434-pinched-plane-rings.md, the reconnaissance addendum and changelog.d/changed/1732-pinched-plane-rings.md.

Testing

Measure unfiltered with keep_ifc (43058503567, code 4f47b837, kept at refs/archive/2026-11-11/cited/4f47b837bb2b, against main aa5dc4c6) and timing (43058508332); the same-project gates and the semantic check pass. No element drawn at main changes: of 4,282 objects drawn on both sides 0 meshes differ (tools/re/ifc_body_diff.py), and no other object differs in geometry or refusal. Against Revit's export the 21 read 1.0063 of its volume (21 of 21 within 1%; Revit's vertices lie up to 0.0047 ft from the mesh). Export time and peak memory of that model read 1.02 and 1.03 of main's. The four rows registered on #1732 hold.

Fixes #1732. Refs #1737.

… there and meshed again when its triangles miss its area (#1732)

A plane face's outline can be one ring that visits a vertex twice: two lobes
that touch at a point. The diagnostic of #1732 (runs 43054812102 and
43055872726) found it on face 171 of the Snowdon Towers Architectural sink
symbol, whose second loop is two thin spandrels under a flat arch that touch
at the crown (points 10 and 21 of 22 are one point). Earcut, given the ring
whole, covers a sliver under the crown too, the triangles add up to 0.65%
more than the ring's area, and the face, with the 21 sanitary terminals that
hold it, is refused for "triangulated area mismatch".

When that check fails, the rings are split at every vertex a ring visits
twice (each lobe becomes a ring that does not start at the shared vertex, so
the nesting test does not read a boundary point; a spike of two points is
dropped) and the face is triangulated again; if the check then passes, the
face is drawn from the split rings, else it is refused as before. A face that
passes the check takes the path it always took, so no element that is drawn
can change. The triangulation moves into plane_mesh unchanged, and
split_pinched_rings has five failure-first tests (a ring that visits no
vertex twice, two lobes, a ring that starts at the shared vertex, a spike,
three lobes at one vertex).
…r registered rows, and the 21 toilets it draws (#1732) (RE-434)

The report states what the diagnostic of #1732 found (one face of the
Toilet-Domestic-3D symbol, a ring of 22 points that visits its crown twice,
earcut covering a sliver under it: 0.65% more area than the ring's), the rule
(split at a repeated vertex, only after the area check fails, so no drawn
element can change) and what it does on the unfiltered run of 4f47b83
against main aa5dc4c: 125 of 126 exports byte for byte main's, Snowdon
Towers Architectural moved by exactly the 21 elements, 4,282 drawn on both
sides with 0 meshes different, the 21 at 1.0063 of Revit's volume (21 of 21
within 1%), and the cost, 34,260 triangles each and +9.9% on the model's IFC
(#1737). All four rows hold. The measured head is archived under
refs/archive/2026-11-11/cited/4f47b837bb2b and the diagnostic build under
refs/archive/2026-11-11/scratch/1732-area-detail.

Also the changelog fragment and the format-reconnaissance addendum.
@DrunkOnJava DrunkOnJava changed the title fix(research): a plane face whose ring visits a vertex twice is split there and meshed again when its triangles miss its area (#1732) fix(research): a plane face whose ring visits a vertex twice is split there and meshed again when its triangles miss its area, and 21 toilets of Snowdon Towers Architectural are drawn from their saved meshes (#1732) (RE-434) Nov 11, 2026
@DrunkOnJava
DrunkOnJava marked this pull request as ready for review November 11, 2026 17:44
@DrunkOnJava
DrunkOnJava merged commit 48b3f35 into main Nov 11, 2026
63 checks passed
@DrunkOnJava
DrunkOnJava deleted the fix/1732-pinched-plane-rings branch November 11, 2026 17:57
DrunkOnJava added a commit that referenced this pull request Nov 11, 2026
…e boundary search takes more than 250 million steps, is refused, and no export of 126 moves (#1748) (#1768)

## Summary

A planar face whose rings hold more than 10,000 points in all, or whose
boundary search and ring split would do more than 250 million units of
work between them (counted for the face in all, its outer rings and the
second try after a split sharing it), is refused as `planar face budget
exceeded` before earcut or the searches can run away, and its element
keeps its box. Earcut, `retain_boundary_points` (for each point earcut
leaves out, every triangle edge tested against every boundary edge: the
cube of a face's points where a ring is mostly collinear points) and,
since #1740, `split_pinched_rings` are super-linear in a face's points,
and a file can give each edge of a ring up to 100,000 of them. The
largest planar face of the corpus holds 2,308 points (Autodesk's Snowdon
Towers Architectural, 4.3 times under the points budget) and the most
work any one call of the boundary search asks is 14,597,894 (the `rme`
samples, 17 times under the work budget, about two seconds of one face
at it): no export of the 126 changes (126 identical on both sides, the
held-out pairs, the Revit 2025 models and every sample among them) and
no refusal is new.

## Motivation

#1748, found by rvtDevelop's read of #1740. The issue asks for a points
budget before earcut and `retain_boundary_points`; the diagnostic found
that a points budget alone does not bound the time (2,308 points can be
minutes of the boundary search where its points are collinear), so the
search is budgeted in the work it does as well.

## Changes

- `src/research/native_saved_mesh.rs`: `PLANAR_FACE_POINT_BUDGET`
(10,000) checked as each ring of a planar face is read through
`planar_points_with` (a checked sum, so a count cannot wrap round), and
`PLANAR_WORK_BUDGET` (250,000,000), one counter for the face that
`face_indexed` makes and `plane_mesh` (so each outer ring, and the
second try after a split) and `split_pinched_rings` (every pair of
points of a ring it compares) charge; a face past either is refused with
`planar face budget exceeded`. Five failure-first tests of the pure
helpers: the points budget at its edge and where a count would wrap
round, the boundary search refused at a small budget and, at the real
one, putting every point back with the square's area, a second call on
the face's counter refused where one alone fits, and a ring of a unique
prefix and lobes refused at a small budget and split at the real one.
- `changelog.d/security/1748-planar-face-budget.md`.

## Testing

Unit tests are banned in this repository except a few failure-first
tests of pure helpers: five, for `planar_points_with`,
`retain_boundary_points_within` and `split_pinched_rings` (none reads a
file). Verified end to end on real files:

- [ ] `full / CI passed` on the final head
- [x] Unfiltered Measure of the first head against `main`
([43085010038](https://github.com/DrunkOnJava/rvt-rs/actions/runs/43085010038),
head `a64259e7`, kept under
`refs/archive/2026-11-11/cited/a64259e74535`, base `main` at
`5e3ac5b0`): **126 exports identical on both sides** (`ifc.sha256`), the
held-out pairs, the Revit 2025 models and every sample among them; no
model's `saved_mesh_refusals` holds `planar face budget exceeded`;
`same-project gates` pass. Rows registered on #1748 before the run
([comment
6804936562](#1748 (comment))):
rows 1 to 3 held.
- [x] The same run on the head after rvtDevelop's read, which counts the
work for the face in all and charges the ring split to it
([43088503271](https://github.com/DrunkOnJava/rvt-rs/actions/runs/43088503271),
head `8c52bb52`; [comment
6805416476](#1748 (comment))):
**126 exports identical again**, no `planar face budget exceeded` on any
model, `same-project gates` and the semantic check pass. The head after
it (`b0cb80a5`) differs from `8c52bb52` by a type alias in the test
module, which clippy's `type_complexity` asked for.
- [x] The budgets come from two diagnostic builds of the planar path
that printed each model's largest planar face and the most work
`retain_boundary_points` did for one (Measure
[43082109644](https://github.com/DrunkOnJava/rvt-rs/actions/runs/43082109644)
and
[43083431385](https://github.com/DrunkOnJava/rvt-rs/actions/runs/43083431385),
69 models, the held-out pairs left out; the build is kept under
`refs/archive/2026-11-11/scratch/1748-planar-points`): 2,308 points on
Snowdon Towers Architectural, 2,006 on the `rme` samples, 546 on
`rac_basic`, 464 on the offices, 128 or fewer on every other model; work
14,597,894 on the `rme` samples, 4,451,767 on the timber office at
permit, 3,650,486 on Snowdon Towers Architectural. The held-out pairs
are read by the Measure above: a face over a budget would have moved an
export.
- Not timed: no export of the corpus reaches either budget, so no path
that runs changes; the added work is one comparison per edge test of the
boundary search.

## Audit-honesty checklist

- [x] A user-visible change has its entry as a fragment under
`changelog.d/security/`.
- [x] No emojis, no private paths in committed files.
- [x] Not a reverse-engineering finding: no report; the evidence is
above.

## Legal and contribution hygiene

- [x] Apache-2.0. No Autodesk proprietary source, internals or NDA
material.
- [x] No new test fixtures.

## Breaking changes

None.

## Related issues

Fixes #1748. Refs #1740, #1732; #1770 holds the two ways to a planar
face outside these budgets (an edge's refinement before its ring is
counted, and a face with regions).
DrunkOnJava added a commit that referenced this pull request Nov 11, 2026
… rings is read and its regions' tests are charged to its work, so a hostile face is refused before it is built (#1770) (#1788)

## Summary

A planar face's points are now counted as each edge of its rings is
read, and the tests of a face with regions are charged to its work,
instead of after its rings are built. #1748 refused a face of more than
10,000 points or 250 million units of work, but `ring_impl` refined each
edge up to 100,000 points before `face_indexed` counted the ring, and
`plane_regions_tile` earcut the parent's ring and every region's with no
cap and tested each region vertex against every parent vertex. Now
`ring_impl` takes the points the face's rings may still hold and counts
each edge as it is read (the graph's own points before any is copied),
`refined_plane_edge` limits the edge's refinement to what is left and
refuses as `planar face budget exceeded` where the face's points ran
out, the parent's ring and the regions' share one such budget, and
`regions_tile` charges a region's vertices times the parent's to the
face's work counter. The budgets' values are #1748's, and no corpus face
reaches either (the largest planar face holds 2,308 points).

## Motivation

#1770, found by rvtDevelop's read of #1768: its two ways to a planar
face outside the budgets.

## Changes

- `src/research/native_saved_mesh.rs`: `ring_impl` and
`refined_plane_edge` take a `limit`; `ring_points_with` is the running
count (an edge's first point is the last of the one before it);
`plane_regions_tile` and `regions_tile` take the face's work counter,
which `face_indexed` now makes before the regions are tested;
`regions_tile_within` is `regions_tile` with the budget given. Two
failure-first tests of the pure helpers (`ring_points_with`: the count
at its limit, an edge's first point not counted twice, an edge of one
point or none, a count that wraps round; `regions_tile_within`: the work
counted for the face and not each call, and a refusal for the budget
told from a ring that does not tile), each killing the mistakes it names
(checked on four mutants of the helpers); the existing `regions_tile`
tests are unchanged but for the counter they pass.
- `changelog.d/security/1770-planar-budget-before-build.md`.

## Testing

Unit tests are banned in this repository except a few failure-first
tests of pure helpers: two, for `ring_points_with` and
`regions_tile_within` (neither reads a file). Verified end to end on
real files:

- [x] Fast CI green on the head (`cargo fmt`, clippy with `-D warnings`,
the two new tests and the existing `regions_tile` ones).
- [x] Unfiltered Measure of the head `bd39ef77` against `main`
`e8a99d03`
([43104964413](https://github.com/DrunkOnJava/rvt-rs/actions/runs/43104964413),
with the held-out pairs; rows registered on #1770 before the run,
[comment
6806613726](#1770 (comment)),
read in the comment after): `ifc.sha256` of all 126 exports identical,
no census line differs, and no `planar face budget exceeded` on either
side of the 101 models that report diagnostics (the other 25 keep counts
only, so there the identical exports are the evidence).
- [ ] `same-project gates` and the semantic check on the measured
commit; `full / CI passed` on the final head
- Not timed: no path that runs changes beyond one comparison per edge
and one product per region.

## Audit-honesty checklist

- [x] A user-visible change has its entry as a fragment under
`changelog.d/security/`.
- [x] No emojis, no private paths in committed files.
- [x] Not a reverse-engineering finding: no report; the evidence is
above.

## Legal and contribution hygiene

- [x] Apache-2.0. No Autodesk proprietary source, internals or NDA
material.
- [x] No new test fixtures.

## Breaking changes

None.

## Related issues

Fixes #1770. Refs #1748, #1768, #1740.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Snowdon Towers Architectural: 21 sanitary terminals refuse for a planar face's triangulated area mismatch once their ruled faces mesh (#1706 step 3)

1 participant