Repository navigation
fix(data): a 3D footprint's union no longer hangs on a curved mesh (#1891) - #1919
Conversation
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Code reviewTwo inline comments are posted (one on Bugs
Security
Performance
Quality
AGENTS.md
Prior review threads: none on this PR, so no earlier concerns were left alone. Change sizeCompared with main (merge base 8f3c5cc to PR head b2b871b): the whole PR, not the latest push.
|
📖 Docs preview
GitHub Pages takes a minute or two to publish a new commit. |
|
Thanks for the review. On the points in the summary (the never-silent one is answered in its thread):
|
Summary
Reading a 3D model could hang: the union that builds an object's footprint (
footprint::footprint→geo::unary_union→i_overlay4.5.2) never finished on the rocking chair in OGC's CityGML 3.0 LoD 3 sample. The footprint is shared by the File Geodatabase multipatch, CityJSON and CityGML readers, so the same faces hang any of them, in any version (the chair in a CityGML 2.0 file hangs onmain).Cause. It isn't a loop. A curved mesh seen from above lays its faces almost on each other, their edges less than a micrometre apart, and the union's work grows with every near crossing: 34 of the chair's faces take 7 ms, 97 take 15 s, 478 more than 90 s, and the 956 never finish.
MAX_UNION_FACES(50,000) bounds how many faces enter a union, not its time.Not a dependency bump.
i_overlay9.1 hangs on the same faces too, andgeo0.33.1, the latest release, pinsi_overlaybelow 4.6.Fix. Before the union, each corner is taken from the shape's lower corner and rounded to a grid, and the union is moved back:
UNION_GRID). On a kilometre that is a millimetre or less, a hundredth of the narrowest faceshows()already takes.What it changes in a footprint. A merged footprint's corners lie within a two-millionth of the shape's size of its faces'. The data's own coordinates don't change. This isn't announced: it is 1/200 of the face width below which
shows()already leaves faces out without a notice, and thefootprintdoc states it.What it doesn't do. The grid narrows the union's worst cases; it doesn't bound its time. The union is still one call that Cancel can't stop, as before this change. Both are said in the doc comment.
Found while testing #1884 (CityGML 3.0), whose pull request follows this one.
Testing
citygml::tests::a_curved_mesh_is_merged_in_a_moment:crates/data/tests/data/rocking-chair.gml, MIT, with its row inATTRIBUTION.mdand the licence in its header) with a 5 s limit, and checks that the faces are merged, not drawn as the outline of their points.UNION_GRID = 0) it fails at the limit.footprint::tests::a_footprint_far_from_the_origin_is_where_its_faces_are: a 10 m box at (458879, 5438353) keeps its corners and its area through the move and back.footprint: about 20 ms (it didn't finish in 5 minutes before).checks.sh(fmt, clippy, nextest, doctests, layers) on macOS: all pass exceptrustgis-engine tests::a_layout_pdf_sets_its_text_in_its_fonts. That test fails alone too, on this branch and with nothing of it on its path: this Mac's "System Font" is drawn at another weight than its file's default and goes out as outlines. It came in with feat(render): embed real fonts in a layout's vector PDF (#1815, part 1) #1828 and doesn't touchfootprint.UI evidence
No visible UI change.
Related issue
Closes #1891
Summary by CodeRabbit