[Bf-blender-cvs] [ed9759349b3] master: Fix T89214: Smooth Vertices (Laplacian) produces NaN coordinates

Campbell Barton noreply at git.blender.org
Thu Aug 5 12:52:09 CEST 2021


Commit: ed9759349b3da090d22bd34bc066b72025679dc4
Author: Campbell Barton
Date:   Thu Aug 5 20:41:23 2021 +1000
Branches: master
https://developer.blender.org/rBed9759349b3da090d22bd34bc066b72025679dc4

Fix T89214: Smooth Vertices (Laplacian) produces NaN coordinates

Vertices with no connected faces would attempt to divide by the combined
face area causing a divide by zero.

Use the same weight for wire vertices as vertices connected
to zero area faces.

===================================================================

M	source/blender/bmesh/operators/bmo_smooth_laplacian.c

===================================================================

diff --git a/source/blender/bmesh/operators/bmo_smooth_laplacian.c b/source/blender/bmesh/operators/bmo_smooth_laplacian.c
index b2b93bfd003..31f66ad952f 100644
--- a/source/blender/bmesh/operators/bmo_smooth_laplacian.c
+++ b/source/blender/bmesh/operators/bmo_smooth_laplacian.c
@@ -533,7 +533,10 @@ void bmo_smooth_laplacian_vert_exec(BMesh *bm, BMOperator *op)
     EIG_linear_solver_right_hand_side_add(sys->context, 1, m_vertex_id, v->co[1]);
     EIG_linear_solver_right_hand_side_add(sys->context, 2, m_vertex_id, v->co[2]);
     i = m_vertex_id;
-    if (sys->zerola[i] == 0) {
+    if ((sys->zerola[i] == 0) &&
+        /* Non zero check is to account for vertices that aren't connected to a selected face.
+         * Without this wire edges become `nan`, see T89214. */
+        (sys->ring_areas[i] != 0.0f)) {
       w = sys->vweights[i] * sys->ring_areas[i];
       sys->vweights[i] = (w == 0.0f) ? 0.0f : -lambda_factor / (4.0f * w);
       w = sys->vlengths[i];



More information about the Bf-blender-cvs mailing list