use bli math functions for vgroup_fix operator.

This commit is contained in:
Campbell Barton 2011-09-22 05:05:26 +00:00
parent 7aa14fdbb9
commit dc09774fb6

@ -955,10 +955,8 @@ static void moveCloserToDistanceFromPlane(Scene *scene, Object *ob, Mesh *me, in
wasChange = FALSE;
dm = dm_deform_recalc(scene, ob);
dm->getVert(dm, index, &m);
oldPos[0] = m.co[0];
oldPos[1] = m.co[1];
oldPos[2] = m.co[2];
distToStart = norm[0]*oldPos[0] + norm[1]*oldPos[1] + norm[2]*oldPos[2] + d;
copy_v3_v3(oldPos, m.co);
distToStart = dot_v3v3(norm, oldPos) + d;
if(distToBe == originalDistToBe) {
distToBe += distToStart - distToStart*strength;
@ -1123,18 +1121,14 @@ static void vgroup_fix(Scene *scene, Object *ob, float distToBe, float strength,
if(count >= 3) {
float d /*, dist */ /* UNUSED */, mag;
float coord[3] = {0};
float norm[3] = {0};
float coord[3];
float norm[3];
getSingleCoordinate(p, count, coord);
dm->getVert(dm, i, &m);
norm[0] = m.co[0]-coord[0];
norm[1] = m.co[1]-coord[1];
norm[2] = m.co[2]-coord[2];
mag = sqrt(norm[0]*norm[0] + norm[1]*norm[1] + norm[2]*norm[2]);
if(mag) {// zeros fix
mul_v3_fl(norm, 1.0f/mag);
d = -norm[0]*coord[0] -norm[1]*coord[1] -norm[2]*coord[2];
sub_v3_v3v3(norm, m.co, coord);
mag= normalize_v3(norm);
if(mag) { /* zeros fix */
d = -dot_v3v3(norm, coord);
/* dist = (norm[0]*m.co[0] + norm[1]*m.co[1] + norm[2]*m.co[2] + d); */ /* UNUSED */
moveCloserToDistanceFromPlane(scene, ob, me, i, norm, coord, d, distToBe, strength, cp);
}