From ed9759349b3da090d22bd34bc066b72025679dc4 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 5 Aug 2021 20:41:23 +1000 Subject: 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. --- source/blender/bmesh/operators/bmo_smooth_laplacian.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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]; -- cgit v1.2.3