Exact planes from snapped vertices, so faces that meet at a corner meet exactly

未关闭
#252 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
35/100
Issue 类型
功能
描述清晰度
描述清楚
活跃度
活跃
技术栈
csharp, unity

调研方向

Start with ExactBrushes.AddPlanes, ExactPlane.Quantize, and ExactJudge to trace how brush planes are created and validated; the issue also names OutputModelWeld and ChiselGeneratorSizeTests.SpiralStairsFilledDown_HaveWallsDownToTheFloor. The change requires snapping brush vertices, deriving shared face planes consistently, and revisiting integer widths and validation. Done when the spiral stairs tests pass with corners meeting exactly and the input check matches the new plane construction.

由索引模型根据 Issue 内容生成。

描述

Problem

The exact CSG rounds every plane of a brush on its own (ExactBrushes.AddPlanes -> ExactPlane.Quantize: unit normal to 2^-20, offset to 1/16384 m). Planes that meet in one point in the brush's float mesh generally no longer meet in one point after rounding. Where more than three planes meet at a corner, the exact polytope gets small extra edges near that corner.

When two of those planes are nearly parallel, the extra edge is long: about 0.03 mm / sin(angle between them). A spiral stairs rail piece is one convex brush whose twisted top is two triangles. At both ends of the fold between them, four planes meet: the end, the side and both triangles, which are only a degree or two apart. The fold then ends 1.65 mm from the corner instead of at it. That leaves a vertex in the middle of the rail's top edge.

The output weld collapses edges shorter than 1 mm (OutputModelWeld.kCollapseLength) to hide these slivers after the fact. It can't reach this one.

Failing tests that show it: ChiselGeneratorSizeTests.SpiralStairsFilledDown_HaveWallsDownToTheFloor (Up and Down).

What the literature does

Plane-based exact Booleans import a mesh by rounding its vertices to an integer grid, and derive each face's plane exactly from three of them (normal = e12 x e13, d = -v.n). Every face plane then passes exactly through its vertices, so faces meeting at a corner meet there exactly, however many there are.

  • Bernstein & Fussell 2009, Fast, Exact, Linear Booleans
  • Campen & Kobbelt 2010, Exact and Robust (Self-)Intersections for Polygonal Meshes
  • Nehring-Wirxel, Trettner & Kobbelt 2021, Fast Exact Booleans for Iterated CSG using Octree-Embedded BSPs (arXiv 2103.02486). Section 1 describes this failure for planes made separately, and section 3.2 gives the bit bounds (27 bit positions, 55 bit normals, 256 bit arithmetic).
  • Trettner, Nehring-Wirxel & Kobbelt 2022, EMBER

What it would take in Chisel

  • Snap each brush's vertices to a grid in tree space, and make each face's exact plane from three of its snapped vertices. Brushes that share a face must pick the same three, by position, so their planes come out exactly opposite.
  • Bit widths: a cross-product normal needs about twice the bits of the coordinates. ExactPlane allows normals below 2^32 and offsets below 2^56 (Int128/Int192 maths). That leaves about 15-16 bits of coordinates across a brush, about 2.8 m on the current 1/16384 m grid. So the exact maths needs wider integers, or the vertex grid needs to be coarser.
  • Snapping nearly-coplanar faces of different brushes onto one plane would then come from the vertex grid, not from rounding the planes.
  • The ExactJudge input check, which rebuilds the expected planes with Quantize, has to follow.
  • Once corners are exact, OutputModelWeld's short-edge collapse may no longer be needed.
主要语言
C#
星标
135
派生
15
平均合并
33 分钟
30 天内合并 PR
122

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

RadicalCSG/com.chisel 的其他 Issue

查看 RadicalCSG/com.chisel 的全部 Issue

相似的 Issue

更多 C# Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。