fix: v2.1 3D 渲染问题根治(profileGeo 自交破面+扇矩形 NaN)

- profileGeo 外轮廓路径自相交(闭合斜边穿过槽口)导致三角剖分破面
  重写为正确顶点顺序的 U 槽简单多边形
- 型材截面挤出抽为共享模块 three/profileGeo.ts(+geometryIsValid 校验器)
- inferSashGlyphs 兜底 bboxOf 误传段对象→修正为有限值点集
  (修复扇矩形 NaN 序列化为 null 的问题)
- 新增 scripts/validate3d.cjs: 254 样板×3700 网格×798 扇
  逐网格 NaN 检测全部通过; 窄条扇合法跳过
This commit is contained in:
HHY
2026-09-21 03:43:26 -07:00
parent 56c154bf81
commit e1572f969d
6 changed files with 136 additions and 37 deletions
+8 -1
View File
@@ -285,7 +285,14 @@ export function inferSashGlyphs(shape: FrameShape, replayed?: Segment[][]): {
}
}
if (unmatched.length && regions.length) {
const fb = bboxOf(regions.flat())
const flatPts: Pt[] = []
for (const r of regions) {
for (const seg of r) {
if (Number.isFinite(seg.ps?.x) && Number.isFinite(seg.ps?.y)) flatPts.push(seg.ps)
if (Number.isFinite(seg.pe?.x) && Number.isFinite(seg.pe?.y)) flatPts.push(seg.pe)
}
}
const fb = bboxOf(flatPts)
const K = unmatched.reduce((s, u) => s + u.entries.length, 0)
const colW = (fb.x1 - fb.x0) / K
let i = 0