Add safe_normalize to cycles, avoid checking length first

This won't give any big speedup,
just avoids redundant sqrtf and may be useful in future.

Differential Revision: https://developer.blender.org/D880
This commit is contained in:
Campbell Barton
2014-11-08 13:35:21 +01:00
parent 112032f2ff
commit 7b873b0662
3 changed files with 24 additions and 9 deletions

View File

@@ -117,8 +117,8 @@ void EdgeDice::stitch_triangles(Patch *patch, vector<int>& outer, vector<int>& i
}
else {
/* length of diagonals */
float len1 = len(mesh_P[inner[i]] - mesh_P[outer[j+1]]);
float len2 = len(mesh_P[outer[j]] - mesh_P[inner[i+1]]);
float len1 = len_squared(mesh_P[inner[i]] - mesh_P[outer[j+1]]);
float len2 = len_squared(mesh_P[outer[j]] - mesh_P[inner[i+1]]);
/* use smallest diagonal */
if(len1 < len2)