BFF::flattenFromScaleFactors gives an overlap where it should give a notch (sign bug in dirichletToNeumann)

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

@joaoajmatos 已经在做这个了。

开始于 2026年11月6日。

  • #264 来自 @joaoajmatos —— 未关闭

评估

难度
4/5
预计耗时
3-5 天
新手友好度
25/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
停滞
技术栈
cpp

调研方向

Start with src/surface/boundary_first_flattening.cpp, especially dirichletToNeumann() and computeBoundaryPositions(), then compare their sign conventions with neumannToDirichlet(). Reproduce the flat disk case with one cone and a boundary cut, and check the scale-factor layout against flattenFromExteriorAngles(). Done means the regression cases pass and the cut forms the expected notch without inverted triangles; a linked pull request is already open.

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

描述

Affects v1.1.0 and current master, src/surface/boundary_first_flattening.cpp.

I was placing a cone singularity, cutting from it to the boundary and flattening
with flattenFromScaleFactors(u). The cut never opened: the two sides crossed,
the layout overlapped itself, and the first ring of triangles at the cone came
out inverted. Took me a while to trust the result, because flatten() on the
same meshes is exact.

What's going on

dirichletToNeumann() and computeBoundaryPositions() disagree on the sign of
u. The layout scales edge lengths by exp(+u):

targetLength(iV) = geo.edgeLengths[e] * exp(0.5 * (uBdy(tail) + uBdy(tip)));

and neumannToDirichlet() agrees with that: it solves

u = -L^{-1} [Omegai ; Omegab - k]

i.e. L u = -(K - K~), which with L = -Δ (the cotan Laplacian as built here,
positive semidefinite) is the Yamabe equation Δu = K - K~ for the metric
exp(2u) g.

dirichletToNeumann() should invert that same relation. Splitting
L u = -(K - K~) into interior and boundary rows:

u_i = -Lii^{-1} (Omegai + Lib u_b)
k   =  Omegab - Lbi Lii^{-1} (Omegai + Lib u_b) + Lbb u_b

What ships is

k   =  Omegab - Lbi Lii^{-1} (Omegai - Lib u_b) - Lbb u_b

which is the right formula evaluated at -u_b. So a cone of +0.5 gets laid
out as a cone of -0.5: instead of removing a 0.5 rad wedge you get 0.5 rad of
extra material, and the cut sides cross. For u = 0 (what flatten() passes)
and for constant u the two agree, since L kills constants, so the default
path never shows it. flattenFromExteriorAngles() is fine too, it goes through
neumannToDirichlet().

Repro

Flat unit disk, one cone of angle 0.5 at the centre vertex, u from the Yamabe
solve with u = 0 on the outer circle, cut along one ray, then
flattenFromScaleFactors(u). Expected: a disk with a 0.5 rad notch, both cut
sides of length 2π/(2π − 0.5) ≈ 1.08646, matching flattenFromExteriorAngles
up to the uniform scale exp(mean u) (neumannToDirichlet() returns mean-zero
u). v1.1.0 gives a 0.5 rad overlap instead, with 16 inverted triangles at the
cone; the cut sides are equal to each other but short, 1.0805 on the unit disk
and about 20% short on a 5k-triangle sphere cap with one cone.

Fix

Two signs in one function:

Vector<double> BFF::dirichletToNeumann(const Vector<double>& uBdy) {
  return Omegab - (Lib.transpose() * Liisolver->solve(Omegai + Lib * uBdy)) + Lbb * uBdy;
}

I have three regression tests (DtN/NtD round trip, scale-factor vs
exterior-angle layouts, and the flat disk with one cone cut to the boundary)
that all fail on v1.1.0 and pass with the change; the rest of the suite is
unchanged (201/201). PR coming right after this.

Workaround if you're on v1.1.0

Pass -u to dirichletToNeumann(), or compute k yourself and call
flattenFromBoth(u, k).

主要语言
C++
星标
1.3k
派生
188
PR 合并指标
30 天内没有已合并 PR

环境准备

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

从这里开始

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

nmwsharp/geometry-central 的其他 Issue

查看 nmwsharp/geometry-central 的全部 Issue

相似的 Issue

更多 C++ Issue

把新 issue 发到你的邮箱

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