nmwsharp / geometry-central

Applied 3D geometry in C++, with a focus on surface meshes.
https://geometry-central.net
MIT License
1.07k stars 149 forks source link

Vector diffusion in corners #167

Open VaitkusM opened 9 months ago

VaitkusM commented 9 months ago

While attempting to smooth out vector and line fields (actually Hopf differentials of a tessellated Bézier surface) with the vertex-based connection Laplacian, I repeatedly found outlying values in boundary corners - as can be seen on these pictures, where Q (in red) is the original line field, while Q (smoothed) (in blue) is the result of 1 step of implicit smoothing with the usual h^2 timestep:

image image

As far as I an tell, I weight everything correctly with the Mass matrix. It happens whether or not the corner has a single "flapping" triangle. I have no boundary conditions (so I guess I implicitly prescribe zero Neumann).

What could be the cause of this phenomenon?

Edit: Tried switching lumped mass matrix to Galerkin, weak Laplacian to strong form, as well as various timesteps (smaller/bigger than h^2, and also keeping it to unity) - the corners (and to a lesser extent boundaries) always stand out...

Edit 2: Also tried the uniform weights in place of cotans with and without degree-based mass - the issue remains. I suspect the problem might be the alignment of the vertex tangent basis vectors: they are everywhere aligned with an outgoing halfedge, except at such corners. image

image

VaitkusM commented 9 months ago

The source of the problem might be the scaling of corner scaled angles at boundary vertices in the IntrinsicGeometryInterface class, which (intrinsically) flattens out the corners: https://github.com/nmwsharp/geometry-central/blob/bafa202c680c1f76f5885317e3b3ef3bff319d89/src/surface/intrinsic_geometry_interface.cpp#L147-L163

Setting the scaling for boundary vertices to 1 seems to fix the vertex tangent basis, as well as the connection Laplacian at corners.