forked from bartvdbraak/blender
Use squared length where possible
This commit is contained in:
parent
2eb50d450c
commit
f1422c40af
@ -447,7 +447,7 @@ static void contarget_get_mesh_mat(Object *ob, const char *substring, float mat[
|
||||
copy_v3_v3(plane, tmat[1]);
|
||||
|
||||
cross_v3_v3v3(mat[0], normal, plane);
|
||||
if (len_v3(mat[0]) < 1e-3f) {
|
||||
if (len_squared_v3(mat[0]) < SQUARE(1e-3f)) {
|
||||
copy_v3_v3(plane, tmat[0]);
|
||||
cross_v3_v3v3(mat[0], normal, plane);
|
||||
}
|
||||
|
@ -1631,7 +1631,7 @@ void mat4_to_dquat(DualQuat *dq, float basemat[4][4], float mat[4][4])
|
||||
|
||||
copy_m3_m4(mat3, mat);
|
||||
|
||||
if (!is_orthonormal_m3(mat3) || (determinant_m4(mat) < 0.0f) || len_v3(dscale) > 1e-4f) {
|
||||
if (!is_orthonormal_m3(mat3) || (determinant_m4(mat) < 0.0f) || len_squared_v3(dscale) > SQUARE(1e-4f)) {
|
||||
/* extract R and S */
|
||||
float tmp[4][4];
|
||||
|
||||
|
@ -565,9 +565,9 @@ void ED_armature_from_edit(bArmature *arm)
|
||||
|
||||
/* remove zero sized bones, this gives unstable restposes */
|
||||
for (eBone = arm->edbo->first; eBone; eBone = neBone) {
|
||||
float len = len_v3v3(eBone->head, eBone->tail);
|
||||
float len_sq = len_squared_v3v3(eBone->head, eBone->tail);
|
||||
neBone = eBone->next;
|
||||
if (len <= 0.000001f) { /* FLT_EPSILON is too large? */
|
||||
if (len_sq <= SQUARE(0.000001f)) { /* FLT_EPSILON is too large? */
|
||||
EditBone *fBone;
|
||||
|
||||
/* Find any bones that refer to this bone */
|
||||
|
@ -981,7 +981,7 @@ static void CalcSnapGeometry(TransInfo *t, float *UNUSED(vec))
|
||||
break;
|
||||
}
|
||||
|
||||
new_dist = len_v3v3(last_p, vec);
|
||||
new_dist = len_squared_v3v3(last_p, vec);
|
||||
|
||||
if (new_dist < max_dist) {
|
||||
copy_v3_v3(p, vec);
|
||||
|
Loading…
Reference in New Issue
Block a user