Skip to content

fix(re): the fitting face scorer tests every vertex and every triangle of a face, not a stride of at most 600 (#2114) - #2122

Merged
DrunkOnJava merged 1 commit into
mainfrom
fix/2114-fitting-faces
Nov 21, 2026
Merged

DrunkOnJava merged 1 commit into
mainfrom
fix/2114-fitting-faces

Conversation

@DrunkOnJava

Copy link
Copy Markdown
Owner

Summary

tools/re/fitting_faces_vs_ifc.py, the scorer of probe_re311_fitting_faces, now tests every vertex, every centroid and every triangle of a face against Revit's body. It used to test a stride of at most 600 of each (#2114).

The stride moved a face's columns when the face only gained triangles, and could leave its farthest vertex untested. The distance routine (nearest) is unchanged; it is given every point.

On the four RE1 models, ifc.sha256, diagnostics.json and the probe's output are identical on both sides: only the scorer changed. Then:

  • 8 face lines move, on RE1 Architecture and RE1 Plumbing: every face over 600 triangles on an element Revit's export has, and no other line;
  • on those faces every second triangle and centroid was tested, and now all are: the winding counts only grow, and 3 faces show 2 or 3 more triangles wound against Revit's;
  • the farthest vertex is identical on every face, as it must be: no face has more than 600 distinct vertices (the most on a scored face is 508), so the vertex stride never applied here.

Motivation

Part of #2114, after #2118 (every vertex of a scored body in mesh_bodies_vs_ifc) and #2119 (which bodies a large class scores).

A search of tools/re for [:: slices, _CAP and SAMPLE constants and stepped range( loops found two more strides. Both choose elements by an even stride over sorted Tags, as #2119's did before it was fixed:

  • frames_vs_ifc.py's frame fit, at most 200 elements, in Measure's default set;
  • saved_meshes_vs_ifc.py's fine rows, at most 300 per class, which print only with fine_mesh=true.

The stepped range( loops in mesh_bodies_vs_ifc.py cut the work into chunks and reach every item. The two strides come next, in their own pull request, so #2114 stays open.

Changes

  • tools/re/fitting_faces_vs_ifc.py:
    • each face's vertices, centroids and triangles are tested whole; the three strides of at most 600 are gone;
    • the docstring says every vertex and triangle is tested, and why.

Testing

Unit tests are banned in this repository: do not add them.

  • Run. Measure 44868163621: this branch (158d752b) against main (339ee7fc), models="re1-*", scorers=none, probe=probe_re311_fitting_faces, probe_scorer=fitting_faces_vs_ifc. Each side runs its own scorer: the base side's winding counts are all 600 or under.

  • Identical inputs. ifc.sha256, diagnostics.json and the probe's output are identical on both sides, on all four models.

  • Rows, written before the run was read. Every volume line, every line about Revit's vertices, and every face line of 600 triangles or fewer is identical. Each face's triangle count and area are identical. On the faces over 600 triangles, the farthest vertex, the triangles compared and those wound alike may rise but not fall. None falls.

    Element Face (triangles) Farthest vertex, ft Wound alike
    Shower head 369643 7.40 (616) 0.00446 308 of 308 → 616 of 616
    Shower head 369643 7.41 (924) 0.00792 462 of 462 → 924 of 924
    Closet bend 444676 7.29 (960) 0.03453 422 of 422 → 843 of 845
    Closet bend 444676 7.30 (960) 0.03404 437 of 437 → 870 of 872
    Closet bend 447845 7.29 (640) 0.01928 264 of 264 → 527 of 527
    Closet bend 447845 7.30 (640) 0.01873 265 of 265 → 529 of 529
    Closet bend 447864 7.29 (640) 0.01928 255 of 255 → 509 of 509
    Closet bend 447864 7.30 (640) 0.01873 263 of 266 → 526 of 532

    "Wound alike" counts the triangles whose centroid lies within 0.03 ft of Revit's body. Those wound against the nearest Revit triangle go from 0 to 2, 0 to 2 and 3 to 6 on three closet bend faces.

  • Coverage. The probe dumps 12 faces over 600 triangles: 4 on RE1 Architecture and 8 on RE1 Plumbing. The other 4 are on two elements for which the scorer finds no Revit body (369628 and 53325), so it writes no line for them. No face has more than 600 distinct vertices (the most on any face is 562, on 53325), so the vertex half of the change is not exercised by these models.

  • Time. The scorer step takes 8.9 s against 8.4 s on RE1 Architecture, and 1.3 s against 1.2 s on RE1 Plumbing (timings.log). The two sides ran as separate jobs, so the difference is not a measured cost. Measure runs this scorer only when a dispatch names it.

  • Python only: python3 -m py_compile. No Rust changes.

Audit-honesty checklist

  • Docs reflect the change: the scorer's docstring. RE-311's figures record what the scorer measured then: its transitions have 60 to 76 triangles, under the stride, and are left as they were.
  • No changelog fragment: a measurement tool, nothing a user of the crate sees.
  • No emojis, private paths or internal jargon.

Legal and contribution hygiene

  • Apache-2.0.
  • No Autodesk proprietary content.
  • No fixtures.

Breaking changes

None. The scorer's output lines keep their form.

Review: rvtReview, the maintainer session, wrote this change. As rvtDevelop is not running, it re-reads the diff and approves the change itself on a green head (Griffin, 2026-11-12).

@DrunkOnJava
DrunkOnJava merged commit 76bdbc5 into main Nov 21, 2026
48 checks passed
@DrunkOnJava
DrunkOnJava deleted the fix/2114-fitting-faces branch November 21, 2026 05:27
DrunkOnJava added a commit that referenced this pull request Nov 21, 2026
… smallest CRC-32 of their Tag, through one shared function, not an even stride by Tag (#2114) (#2123)

## Summary

The frame fit (`frames_vs_ifc.py`) and the `fine` rows of
`saved_meshes_vs_ifc.py` now choose their elements by the smallest
CRC-32 of their Tag, as the body scorers have since #2119. Before, they
took an even stride over the sorted Tags, which could move every chosen
element when one was added or removed (#2114).

The choice now lives in one shared function, `ifc_common.tag_sample`.
`mesh_bodies_vs_ifc.class_sample` calls it, with the same result as
before.

On identical exports of 42 models (`ifc.sha256` and `diagnostics.json`
unchanged: only the scorers changed), scored by this branch and by
`main`:
- `mesh_bodies_vs_ifc`'s output is identical on every model;
- `frames_vs_ifc` moves on the 9 models with more than 200 common
elements. Each now compares 200 elements, where the stride took 139 to
192. The fit lines move. The residual after Revit's site placement alone
stays at median 0.0000 on all 35 models that print it, and its maximum
moves on 5: up on the two concrete housing files (4.09 to 4.16 m) and
the office permit (0.228 to 0.246 m), down on both timber office files
(0.9075 to 0.2175 m). The maximum is still over a sample of 200;
- the `fine` rows move on the 10 BIM4LCA files where a class has more
than 300 paired elements. Each such class now scores 300, where the
stride took 170 to 296. Every element added is within 0.001 ft, like
those before it. Nothing outside the `fine` rows moves.

## Motivation

Closes #2114. #2118 tested every vertex of a scored body, #2119 chose a
large class's bodies by CRC-32, and #2122 tested every point of a
fitting's faces. A search of `tools/re` for `[::` slices, first-N cuts,
`_CAP`, `SAMPLE`, `LIMIT` and `MAX_` constants and stepped `range(`
loops found these two strides as the last ones that choose what is
scored. What else it found:
- display limits (`LISTED`, `SHOW`, `LIST_LIMIT`), which shorten printed
listings, not counts;
- triangle caps, under which a larger body is counted and not read;
- `wall_top_cover_vs_ifc.py`'s stations, set by a wall's length;
- stepped `range(` loops in `mesh_bodies_vs_ifc.py`, which cut the work
into chunks and reach every item.

## Changes

- **`tools/re/ifc_common.py`:** `tag_sample(tags, cap)`, moved from
`mesh_bodies_vs_ifc.class_sample` with its docstring generalised.
- **`tools/re/mesh_bodies_vs_ifc.py`:** `class_sample` calls
`tag_sample`; `saved_mesh_status_vs_ifc.py`'s import of it is unchanged.
- **`tools/re/frames_vs_ifc.py`:** the 200 centres come from
`tag_sample`; the docstring says how they are chosen.
- **`tools/re/saved_meshes_vs_ifc.py`:** the `fine` rows' 300 per class
come from `tag_sample`; both docstrings say so.

## Testing

Unit tests are banned in this repository: do not add them.

- [x] **Runs.** Measure on `main`'s code (`339ee7fc`), `nordic`,
`r2025`, `fine_mesh=true`, `scorers="frames_vs_ifc saved_meshes_vs_ifc
mesh_bodies_vs_ifc"`:
[44869977616](https://github.com/DrunkOnJava/rvt-rs/actions/runs/44869977616)
with this branch's scorers (`e1bd4b09`),
[44869990078](https://github.com/DrunkOnJava/rvt-rs/actions/runs/44869990078)
with `main`'s. No step on either side came from the score cache, whose
key covers each scorer and every module it imports.
- [x] **Identical inputs.** All 42 models have the same `ifc.sha256` on
both runs.
- [x] **Rows, written before either run was read.**
- `mesh_bodies_vs_ifc`: identical on all 41 models it scores, `fine`
rows included.
- `frames_vs_ifc`: header lines and "elements tagged in both" identical
everywhere; the whole output identical on models with 200 or fewer.

    | Model | Common | Compared | Fitted residual, median / max (m) |
    | --- | ---: | --- | --- |
    | Core Interior | 696 | 174 → 200 | 0.0000 / 0.0000, unchanged |
| Housing, concrete, as built | 444 | 148 → 200 | 0.0451 / 4.0467 →
0.0539 / 4.1050 |
| Housing, concrete, permit | 416 | 139 → 200 | 0.0472 / 4.0476 → 0.0531
/ 4.1054 |
| Housing, timber, as built | 504 | 168 → 200 | 0.0392 / 4.1722 → 0.0557
/ 4.1555 |
| Housing, timber, permit | 492 | 164 → 200 | 0.0407 / 4.1709 → 0.0563 /
4.1549 |
| Office, as built | 957 | 192 → 200 | 0.0017 / 0.2058 → 0.0043 / 0.2016
|
| Office, permit | 1,005 | 168 → 200 | 0.0049 / 0.2235 → 0.0060 / 0.2418
|
| Office, timber, as built | 1,085 | 181 → 200 | 0.0088 / 0.8946 →
0.0037 / 0.2141 |
| Office, timber, permit | 1,056 | 176 → 200 | 0.0084 / 0.8969 → 0.0038
/ 0.2144 |

- `saved_meshes_vs_ifc`: everything before the `fine` rows identical
everywhere. Only classes over 300 move, and each to 300, every element
within 0.001 ft: `IfcMember` on all 10 files (178 to 296 before), and
`IfcColumn` on the two timber office files (172 and 170). "Sampled
elements meshed" rises with them (for example 686 → 808 on the concrete
housing as built).
- [x] **Time.** The two runs ran on different runners, and the step
times moved both ways (the `saved_meshes_vs_ifc` step on the office as
built 316 → 476 s, on the timber office as built 459 → 308 s), so no
cost is measured. `fine` rows print only with `fine_mesh=true`.
- [x] Python only: `python3 -m py_compile` on the five files. No Rust
changes.

## Audit-honesty checklist

- [x] Docs reflect the change: the docstrings. Figures quoted in older
reports record what the scorers measured then, and are left as they
were.
- [x] No changelog fragment: a measurement tool, nothing a user of the
crate sees.
- [x] No emojis, private paths or internal jargon.

## Legal and contribution hygiene

- [x] Apache-2.0.
- [x] No Autodesk proprietary content.
- [x] No fixtures.

## Breaking changes

None. `class_sample` keeps its name and its result.

Review: rvtReview, the maintainer session, wrote this change. As
rvtDevelop is not running, it re-reads the diff and approves the change
itself on a green head (Griffin, 2026-11-12).
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.

1 participant