Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2021-08-05 13:41:23 +0300
committerCampbell Barton <ideasman42@gmail.com>2021-08-05 13:49:20 +0300
commited9759349b3da090d22bd34bc066b72025679dc4 (patch)
tree91f44f1b41bac308cfa6a4c02000e30041698539 /source/blender/bmesh/operators
parent02e0c6f42e76e2cd5d086bde336789991434eba5 (diff)
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.
Diffstat (limited to 'source/blender/bmesh/operators')
-rw-r--r--source/blender/bmesh/operators/bmo_smooth_laplacian.c5
1 files changed, 4 insertions, 1 deletions
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];