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:
authorLuca Rood <dev@lucarood.com>2017-01-11 19:49:12 +0300
committerLuca Rood <dev@lucarood.com>2017-01-11 20:52:32 +0300
commit8745cd825a7beeed5bd4ecec0622162033f47635 (patch)
treef611477d6dcb97d8e0a80cadc3c8f9902a4c70b2
parent28622ae81e2ccc9ff26a8007dd8968baf3eccbbd (diff)
Remove custom weight interp func in favor of Blender's built-in implementation
-rw-r--r--source/blender/modifiers/intern/MOD_surfacedeform.c47
1 files changed, 1 insertions, 46 deletions
diff --git a/source/blender/modifiers/intern/MOD_surfacedeform.c b/source/blender/modifiers/intern/MOD_surfacedeform.c
index 65f4e96b3cd..49be656ff08 100644
--- a/source/blender/modifiers/intern/MOD_surfacedeform.c
+++ b/source/blender/modifiers/intern/MOD_surfacedeform.c
@@ -281,51 +281,6 @@ BLI_INLINE void sortPolyVertsTri(int *indices, const MLoop * const mloop, const
}
}
-BLI_INLINE void meanValueCoordinates(float w[], const float point[2], const float verts[][2], const int num)
-{
- float vec_curr[2], vec_prev[2], vec_tmp[2];
- float tan_prev, tan_curr, mag_curr, mag_next;
- float tot_w = 0;
- int i, ind_curr;
-
- sub_v2_v2v2(vec_tmp, verts[num - 2], point);
- sub_v2_v2v2(vec_prev, verts[num - 1], point);
-
- mag_curr = normalize_v2(vec_prev);
- normalize_v2(vec_tmp);
-
- tan_prev = tan(saacos(dot_v2v2(vec_prev, vec_tmp)) / 2.0f);
-
- for (i = 0; i < num; i++) {
- sub_v2_v2v2(vec_curr, verts[i], point);
- mag_next = normalize_v2(vec_curr);
-
- tan_curr = tan(saacos(dot_v2v2(vec_curr, vec_prev)) / 2.0f);
-
- ind_curr = (i == 0) ? (num - 1) : (i - 1);
-
- if (mag_curr >= FLT_EPSILON) {
- w[ind_curr] = (tan_prev + tan_curr) / mag_curr;
- tot_w += w[ind_curr];
- }
- else {
- for (i = 0; i < num; i++) {
- w[i] = 0.0f;
- }
- w[ind_curr] = 1.0f;
- return;
- }
-
- mag_curr = mag_next;
- tan_prev = tan_curr;
- copy_v2_v2(vec_prev, vec_curr);
- }
-
- for (i = 0; i < num; i++) {
- w[i] /= tot_w;
- }
-}
-
BLI_INLINE int nearestVert(SDefBindCalcData * const data, const float point_co[3])
{
const MVert * const mvert = data->mvert;
@@ -851,7 +806,7 @@ static void bindVert(void *userdata, void *UNUSED(userdata_chunk), const int ind
return;
}
- meanValueCoordinates(sdbind->vert_weights, bpoly->point_v2, bpoly->coords_v2, bpoly->numverts);
+ interp_weights_poly_v2(sdbind->vert_weights, bpoly->coords_v2, bpoly->numverts, bpoly->point_v2);
/* Reproject vert based on weights and original poly verts, to reintroduce poly non-planarity */
zero_v3(point_co_proj);