diff options
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r-- | source/blender/blenlib/BLI_ghash.h | 7 | ||||
-rw-r--r-- | source/blender/blenlib/intern/math_geom.c | 12 | ||||
-rw-r--r-- | source/blender/blenlib/intern/math_matrix.c | 8 | ||||
-rw-r--r-- | source/blender/blenlib/intern/math_rotation.c | 13 | ||||
-rw-r--r-- | source/blender/blenlib/intern/math_vector.c | 6 | ||||
-rw-r--r-- | source/blender/blenlib/intern/pbvh.c | 2 | ||||
-rw-r--r-- | source/blender/blenlib/intern/winstuff.c | 1 |
7 files changed, 17 insertions, 32 deletions
diff --git a/source/blender/blenlib/BLI_ghash.h b/source/blender/blenlib/BLI_ghash.h index 92a99c9a3b4..0e985184f7a 100644 --- a/source/blender/blenlib/BLI_ghash.h +++ b/source/blender/blenlib/BLI_ghash.h @@ -36,12 +36,11 @@ extern "C" { #endif -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "BKE_utildefines.h" -#include "MEM_guardedalloc.h" #include "BLI_mempool.h" #include "BLI_blenlib.h" diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c index fd0829ebe3b..68b1feea632 100644 --- a/source/blender/blenlib/intern/math_geom.c +++ b/source/blender/blenlib/intern/math_geom.c @@ -841,10 +841,8 @@ int isect_line_line_v3(float v1[3], float v2[3], float v3[3], float v4[3], float sub_v3_v3v3(a, v2, v1); sub_v3_v3v3(b, v4, v3); - copy_v3_v3(dir1, a); - normalize_v3(dir1); - copy_v3_v3(dir2, b); - normalize_v3(dir2); + normalize_v3_v3(dir1, a); + normalize_v3_v3(dir2, b); d = dot_v3v3(dir1, dir2); if (d == 1.0f || d == -1.0f) { /* colinear */ @@ -908,10 +906,8 @@ int isect_line_line_strict_v3(float v1[3], float v2[3], float v3[3], float v4[3] sub_v3_v3v3(a, v2, v1); sub_v3_v3v3(b, v4, v3); - copy_v3_v3(dir1, a); - normalize_v3(dir1); - copy_v3_v3(dir2, b); - normalize_v3(dir2); + normalize_v3_v3(dir1, a); + normalize_v3_v3(dir2, b); d = dot_v3v3(dir1, dir2); if (d == 1.0f || d == -1.0f || d == 0) { /* colinear or one vector is zero-length*/ diff --git a/source/blender/blenlib/intern/math_matrix.c b/source/blender/blenlib/intern/math_matrix.c index 6c06da2e32d..64c3e746982 100644 --- a/source/blender/blenlib/intern/math_matrix.c +++ b/source/blender/blenlib/intern/math_matrix.c @@ -595,9 +595,7 @@ void transpose_m4(float mat[][4]) void orthogonalize_m3(float mat[][3], int axis) { float size[3]; - size[0] = len_v3(mat[0]); - size[1] = len_v3(mat[1]); - size[2] = len_v3(mat[2]); + mat3_to_size(size, mat); normalize_v3(mat[axis]); switch(axis) { @@ -658,9 +656,7 @@ void orthogonalize_m3(float mat[][3], int axis) void orthogonalize_m4(float mat[][4], int axis) { float size[3]; - size[0] = len_v3(mat[0]); - size[1] = len_v3(mat[1]); - size[2] = len_v3(mat[2]); + mat4_to_size(size, mat); normalize_v3(mat[axis]); switch(axis) { diff --git a/source/blender/blenlib/intern/math_rotation.c b/source/blender/blenlib/intern/math_rotation.c index 4d015e527a8..f72269f6d7b 100644 --- a/source/blender/blenlib/intern/math_rotation.c +++ b/source/blender/blenlib/intern/math_rotation.c @@ -135,10 +135,7 @@ void mul_fac_qt_fl(float *q, const float fac) float si= (float)sin(angle); q[0]= co; normalize_v3(q+1); - q[1]*= si; - q[2]*= si; - q[3]*= si; - + mul_v3_fl(q+1, si); } void quat_to_mat3(float m[][3], float *q) @@ -595,9 +592,8 @@ void axis_angle_to_quat(float q[4], float axis[3], float angle) { float nor[3]; float si; - - copy_v3_v3(nor, axis); - normalize_v3(nor); + + normalize_v3_v3(nor, axis); angle /= 2; si = (float)sin(angle); @@ -654,8 +650,7 @@ void axis_angle_to_mat3(float mat[3][3],float axis[3], float angle) float nor[3], nsi[3], co, si, ico; /* normalise the axis first (to remove unwanted scaling) */ - copy_v3_v3(nor, axis); - normalize_v3(nor); + normalize_v3_v3(nor, axis); /* now convert this to a 3x3 matrix */ co= (float)cos(angle); diff --git a/source/blender/blenlib/intern/math_vector.c b/source/blender/blenlib/intern/math_vector.c index 9baf897c830..b1cea9ab3c4 100644 --- a/source/blender/blenlib/intern/math_vector.c +++ b/source/blender/blenlib/intern/math_vector.c @@ -120,10 +120,8 @@ float angle_v3v3(float *v1, float *v2) { float vec1[3], vec2[3]; - copy_v3_v3(vec1, v1); - copy_v3_v3(vec2, v2); - normalize_v3(vec1); - normalize_v3(vec2); + normalize_v3_v3(vec1, v1); + normalize_v3_v3(vec2, v2); return angle_normalized_v3v3(vec1, vec2); } diff --git a/source/blender/blenlib/intern/pbvh.c b/source/blender/blenlib/intern/pbvh.c index 7069eeea510..bd721871f0a 100644 --- a/source/blender/blenlib/intern/pbvh.c +++ b/source/blender/blenlib/intern/pbvh.c @@ -24,6 +24,8 @@ #include "DNA_meshdata_types.h" +#include "MEM_guardedalloc.h" + #include "BLI_math.h" #include "BLI_ghash.h" #include "BLI_pbvh.h" diff --git a/source/blender/blenlib/intern/winstuff.c b/source/blender/blenlib/intern/winstuff.c index f2261546f5c..81a635205f9 100644 --- a/source/blender/blenlib/intern/winstuff.c +++ b/source/blender/blenlib/intern/winstuff.c @@ -33,7 +33,6 @@ #include <stdlib.h> #include <stdio.h> -#include "MEM_guardedalloc.h" #include "BLI_path_util.h" #include "BLI_string.h" |