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:
Diffstat (limited to 'source/blender/modifiers/intern/MOD_laplaciandeform.c')
-rw-r--r--source/blender/modifiers/intern/MOD_laplaciandeform.c28
1 files changed, 5 insertions, 23 deletions
diff --git a/source/blender/modifiers/intern/MOD_laplaciandeform.c b/source/blender/modifiers/intern/MOD_laplaciandeform.c
index 8e2a58b2236..31bae2a192e 100644
--- a/source/blender/modifiers/intern/MOD_laplaciandeform.c
+++ b/source/blender/modifiers/intern/MOD_laplaciandeform.c
@@ -138,24 +138,6 @@ static void deleteLaplacianSystem(LaplacianSystem *sys)
MEM_SAFE_FREE(sys);
}
-static float cotan_weight(const float v1[3], const float v2[3], const float v3[3])
-{
- 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 > FLT_EPSILON) {
- return dot_v3v3(a, b) / clen;
- }
- else {
- return 0.0f;
- }
-}
-
static void createFaceRingMap(
const int mvert_tot, const MFace *mface, const int mface_tot,
MeshElemMap **r_map, int **r_indices)
@@ -306,9 +288,9 @@ static void initLaplacianMatrix(LaplacianSystem *sys)
if (has_4_vert) {
- w2 = (cotan_weight(v4, v1, v2) + cotan_weight(v3, v1, v2)) / 2.0f;
- w3 = (cotan_weight(v2, v3, v1) + cotan_weight(v4, v1, v3)) / 2.0f;
- w4 = (cotan_weight(v2, v4, v1) + cotan_weight(v3, v4, v1)) / 2.0f;
+ w2 = (cotangent_tri_weight_v3(v4, v1, v2) + cotangent_tri_weight_v3(v3, v1, v2)) / 2.0f;
+ w3 = (cotangent_tri_weight_v3(v2, v3, v1) + cotangent_tri_weight_v3(v4, v1, v3)) / 2.0f;
+ w4 = (cotangent_tri_weight_v3(v2, v4, v1) + cotangent_tri_weight_v3(v3, v4, v1)) / 2.0f;
sys->delta[idv1][0] -= v4[0] * w4;
sys->delta[idv1][1] -= v4[1] * w4;
@@ -321,8 +303,8 @@ static void initLaplacianMatrix(LaplacianSystem *sys)
nlMatrixAdd(idv1, idv4, -w4);
}
else {
- w2 = cotan_weight(v3, v1, v2);
- w3 = cotan_weight(v2, v3, v1);
+ w2 = cotangent_tri_weight_v3(v3, v1, v2);
+ w3 = cotangent_tri_weight_v3(v2, v3, v1);
w4 = 0.0f;
}