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:
authorCampbell Barton <ideasman42@gmail.com>2010-10-22 07:56:50 +0400
committerCampbell Barton <ideasman42@gmail.com>2010-10-22 07:56:50 +0400
commit2fe940f8df9c4513ad1ad0674f49818417450984 (patch)
tree973e55b1f0ea46b3018c0993efeaa3b22f1173dc /source/blender/blenlib/intern/math_matrix.c
parentbcac1def4c1b459e116ae1957e8ac4e20a7d9192 (diff)
Fix for snapping pose bones with axis-angle rotation.
- armature_mat_pose_to_bone() was missing axis-angle check. - added loc_axisangle_size_to_mat4() for completeness. - use 'const' prefix where possible in math rotation functions.
Diffstat (limited to 'source/blender/blenlib/intern/math_matrix.c')
-rw-r--r--source/blender/blenlib/intern/math_matrix.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/source/blender/blenlib/intern/math_matrix.c b/source/blender/blenlib/intern/math_matrix.c
index 9bbd0fc64ac..86eee4c2202 100644
--- a/source/blender/blenlib/intern/math_matrix.c
+++ b/source/blender/blenlib/intern/math_matrix.c
@@ -898,7 +898,7 @@ float determinant_m4(float m[][4])
/****************************** Transformations ******************************/
-void size_to_mat3(float mat[][3], float *size)
+void size_to_mat3(float mat[][3], const float size[3])
{
mat[0][0]= size[0];
mat[0][1]= 0.0f;
@@ -911,7 +911,7 @@ void size_to_mat3(float mat[][3], float *size)
mat[2][0]= 0.0f;
}
-void size_to_mat4(float mat[][4], float *size)
+void size_to_mat4(float mat[][4], const float size[3])
{
float tmat[3][3];
@@ -1078,7 +1078,7 @@ int is_negative_m4(float mat[][4])
/* make a 4x4 matrix out of 3 transform components */
/* matrices are made in the order: scale * rot * loc */
// TODO: need to have a version that allows for rotation order...
-void loc_eul_size_to_mat4(float mat[4][4], float loc[3], float eul[3], float size[3])
+void loc_eul_size_to_mat4(float mat[4][4], const float loc[3], const float eul[3], const float size[3])
{
float rmat[3][3], smat[3][3], tmat[3][3];
@@ -1101,7 +1101,7 @@ void loc_eul_size_to_mat4(float mat[4][4], float loc[3], float eul[3], float siz
/* make a 4x4 matrix out of 3 transform components */
/* matrices are made in the order: scale * rot * loc */
-void loc_eulO_size_to_mat4(float mat[4][4], float loc[3], float eul[3], float size[3], short rotOrder)
+void loc_eulO_size_to_mat4(float mat[4][4], const float loc[3], const float eul[3], const float size[3], const short rotOrder)
{
float rmat[3][3], smat[3][3], tmat[3][3];
@@ -1125,7 +1125,7 @@ void loc_eulO_size_to_mat4(float mat[4][4], float loc[3], float eul[3], float si
/* make a 4x4 matrix out of 3 transform components */
/* matrices are made in the order: scale * rot * loc */
-void loc_quat_size_to_mat4(float mat[4][4], float loc[3], float quat[4], float size[3])
+void loc_quat_size_to_mat4(float mat[4][4], const float loc[3], const float quat[4], const float size[3])
{
float rmat[3][3], smat[3][3], tmat[3][3];
@@ -1146,6 +1146,13 @@ void loc_quat_size_to_mat4(float mat[4][4], float loc[3], float quat[4], float s
mat[3][2] = loc[2];
}
+void loc_axisangle_size_to_mat4(float mat[4][4], const float loc[3], const float axis[3], const float angle, const float size[3])
+{
+ float q[4];
+ axis_angle_to_quat(q, axis, angle);
+ loc_quat_size_to_mat4(mat, loc, q, size);
+}
+
/*********************************** Other ***********************************/
void print_m3(char *str, float m[][3])