diff options
Diffstat (limited to 'source/blender/bmesh')
-rw-r--r-- | source/blender/bmesh/operators/bmo_smooth_laplacian.c | 35 |
1 files changed, 9 insertions, 26 deletions
diff --git a/source/blender/bmesh/operators/bmo_smooth_laplacian.c b/source/blender/bmesh/operators/bmo_smooth_laplacian.c index e6321341950..af5f35f2a75 100644 --- a/source/blender/bmesh/operators/bmo_smooth_laplacian.c +++ b/source/blender/bmesh/operators/bmo_smooth_laplacian.c @@ -66,7 +66,6 @@ struct BLaplacianSystem { }; typedef struct BLaplacianSystem LaplacianSystem; -static float cotan_weight(float *v1, float *v2, float *v3); static bool vert_is_boundary(BMVert *v); static LaplacianSystem *init_laplacian_system(int a_numEdges, int a_numFaces, int a_numVerts); static void init_laplacian_matrix(LaplacianSystem *sys); @@ -261,9 +260,9 @@ static void init_laplacian_matrix(LaplacianSystem *sys) v3 = vf[(j + 2) % 4]->co; v4 = vf[(j + 3) % 4]->co; - w2 = cotan_weight(v4, v1, v2) + cotan_weight(v3, v1, v2); - w3 = cotan_weight(v2, v3, v1) + cotan_weight(v4, v1, v3); - w4 = cotan_weight(v2, v4, v1) + cotan_weight(v3, v4, v1); + w2 = cotangent_tri_weight_v3(v4, v1, v2) + cotangent_tri_weight_v3(v3, v1, v2); + w3 = cotangent_tri_weight_v3(v2, v3, v1) + cotangent_tri_weight_v3(v4, v1, v3); + w4 = cotangent_tri_weight_v3(v2, v4, v1) + cotangent_tri_weight_v3(v3, v4, v1); sys->vweights[idv1] += (w2 + w3 + w4) / 4.0f; } @@ -271,9 +270,9 @@ static void init_laplacian_matrix(LaplacianSystem *sys) else { i = BM_elem_index_get(f); - w1 = cotan_weight(v1, v2, v3); - w2 = cotan_weight(v2, v3, v1); - w3 = cotan_weight(v3, v1, v2); + w1 = cotangent_tri_weight_v3(v1, v2, v3); + w2 = cotangent_tri_weight_v3(v2, v3, v1); + w3 = cotangent_tri_weight_v3(v3, v1, v2); sys->fweights[i][0] += w1; sys->fweights[i][1] += w2; @@ -325,9 +324,9 @@ static void fill_laplacian_matrix(LaplacianSystem *sys) v3 = vf[(j + 2) % 4]->co; v4 = vf[(j + 3) % 4]->co; - w2 = cotan_weight(v4, v1, v2) + cotan_weight(v3, v1, v2); - w3 = cotan_weight(v2, v3, v1) + cotan_weight(v4, v1, v3); - w4 = cotan_weight(v2, v4, v1) + cotan_weight(v3, v4, v1); + w2 = cotangent_tri_weight_v3(v4, v1, v2) + cotangent_tri_weight_v3(v3, v1, v2); + w3 = cotangent_tri_weight_v3(v2, v3, v1) + cotangent_tri_weight_v3(v4, v1, v3); + w4 = cotangent_tri_weight_v3(v2, v4, v1) + cotangent_tri_weight_v3(v3, v4, v1); w2 = w2 / 4.0f; w3 = w3 / 4.0f; @@ -376,22 +375,6 @@ static void fill_laplacian_matrix(LaplacianSystem *sys) } } -static float cotan_weight(float *v1, float *v2, float *v3) -{ - float a[3], b[3], c[3], clen; - - sub_v3_v3v3(a, v2, v1); - sub_v3_v3v3(b, v3, v1); - cross_v3_v3v3(c, a, b); - - clen = len_v3(c); - - if (clen == 0.0f) - return 0.0f; - - return dot_v3v3(a, b) / clen; -} - static bool vert_is_boundary(BMVert *v) { BMEdge *ed; |