Commit 18187fa
authored
* fix(geometry): sample trimmed-circle directrix arcs in 3D (#1348)
IfcSweptDiskSolid rebar (IfcReinforcingBar) whose directrix is an
IfcCompositeCurve with arc bends rendered mangled — the L-bar grew a
spurious hook, the U-bar twisted into a crumpled mess.
Root cause: a directrix segment that is an IfcTrimmedCurve over an
IfcCircle/IfcEllipse was sampled through the 2D conic path and lifted
with z=0, dropping the arc's out-of-plane component. The bend arcs in
these files live in the XZ plane (the circle's IfcAxis2Placement3D has
a non-Z axis), so the flattened arc landed in the wrong plane and broke
the directrix that the disk is swept along.
Fix: route trimmed circle/ellipse directrix segments through a new
process_trimmed_conic_3d that samples the arc against the conic's full
3D placement (center + X/Y axes), honouring parameter and cartesian
trim bounds and matching the 2D sampler's segment-density budget. The
3D placement reader is shared with the existing full-circle sampler;
the planar (IfcAxis2Placement2D) branch now also honours RefDirection.
Both the trimmed and non-trimmed composite-curve directrix paths route
through the fixed sampler.
Adds neutral, self-contained L-bar and U-bar fixtures (faithful copies
of the reported geometry chains) plus regression tests asserting the
directrix stays in its authored plane and the swept tube stays thin.
* test(geometry): add crank-bar (shape 26) regression for #1350
Issue #1350 (crank bar renders nothing when viewed alone) shares the
#1348 root cause: a trimmed-circle directrix arc flattened to z=0. Here
the two bends are tiny (~4.7°), so the pre-fix mangling was subtle
(directrix Y deflection ~10.7 mm) but the resulting self-intersecting
tube degenerated enough that the viewer dropped it entirely.
Adds a neutral crank-bar fixture (faithful copy of the reported
geometry: line, tiny arc, offset run, tiny arc, line) plus a
directrix-planarity test (catches the regression: max |y| 10.7 mm pre-fix
vs ~0 fixed) and a renders-non-empty test. With the directrix sampled in
3D the crank produces a clean 384-triangle swept tube.
* fix(viewer): keep small high-aspect elements compact-framed (#1350)
A single IfcReinforcingBar viewed alone loaded correct geometry but
rendered as nothing. The camera-fit policy classifies any bounding box
with aspect > 50:1 as "linear infrastructure" and frames it from inside
the bbox looking down the longest axis — the right pose for a 900 m
railway alignment, but for a 4.86 m rebar (aspect ~130:1) it points the
camera end-on down the bar so it projects to a sub-pixel smear.
Gate the linear policy on an absolute size floor: the longest axis must
be at least 100 m. Below that the compact SE-isometric pose frames the
whole element (as it already did for the lower-aspect L-bar). The floor
is overridable for tests. Railway/road alignments (hundreds of metres)
are unaffected; the smallest existing linear-branch test is 100 m.
Adds changesets: the swept-disk arc 3D fix ships in @ifc-lite/wasm and
this camera-fit fix in @ifc-lite/renderer. Together with the geometry
fix this closes #1350.
1 parent 0b73ebb commit 18187fa
9 files changed
Lines changed: 674 additions & 26 deletions
File tree
- .changeset
- packages/renderer/src
- rust/geometry
- src
- tests
- fixtures
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
59 | 91 | | |
60 | 92 | | |
61 | 93 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
33 | 48 | | |
34 | 49 | | |
35 | 50 | | |
| |||
78 | 93 | | |
79 | 94 | | |
80 | 95 | | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
81 | 102 | | |
82 | 103 | | |
83 | 104 | | |
| |||
106 | 127 | | |
107 | 128 | | |
108 | 129 | | |
109 | | - | |
110 | | - | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
111 | 138 | | |
112 | 139 | | |
113 | 140 | | |
| |||
0 commit comments