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:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2009-10-29 13:12:07 +0300
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2009-10-29 13:12:07 +0300
commita365ccd20eac888417b63b173e168d3338a5a45b (patch)
treeac0006461cfaabe64719cf6e30fc7dc3e6286d1e /source/blender/blenlib
parent7ce5c951c5bb3607cac2bc603ed9a1fbcc5299dd (diff)
parente14a8635cca97f339d28744624cf1284866bc63d (diff)
Sculpt: svn merge https://svn.blender.org/svnroot/bf-blender/trunk/blender -r24095:24152
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r--source/blender/blenlib/BLI_arithb.h2
-rw-r--r--source/blender/blenlib/intern/arithb.c63
2 files changed, 64 insertions, 1 deletions
diff --git a/source/blender/blenlib/BLI_arithb.h b/source/blender/blenlib/BLI_arithb.h
index fdccb3854a6..901caaee15f 100644
--- a/source/blender/blenlib/BLI_arithb.h
+++ b/source/blender/blenlib/BLI_arithb.h
@@ -218,7 +218,7 @@ void Mat4ToEul(float tmat[][4],float *eul);
void EulToQuat(float *eul, float *quat);
void Mat3ToCompatibleEul(float mat[][3], float *eul, float *oldrot);
-
+void EulToGimbalAxis(float gmat[][3], float *eul, short order);
void compatible_eul(float *eul, float *oldrot);
diff --git a/source/blender/blenlib/intern/arithb.c b/source/blender/blenlib/intern/arithb.c
index 85cd46e6f33..f353a90ab21 100644
--- a/source/blender/blenlib/intern/arithb.c
+++ b/source/blender/blenlib/intern/arithb.c
@@ -3312,6 +3312,69 @@ void Mat3ToCompatibleEul(float mat[][3], float *eul, float *oldrot)
}
+/* the matrix is written to as 3 axis vectors */
+void EulToGimbalAxis(float gmat[][3], float *eul, short order)
+{
+ RotOrderInfo *R= GET_ROTATIONORDER_INFO(order);
+ short R_order[3];
+ short R_order2[3];
+
+ float quat[4];
+ float teul[3];
+ float tvec[3];
+ int i, a;
+
+ R_order2[R->i]= 0;
+ R_order2[R->j]= 1;
+ R_order2[R->k]= 2;
+
+ R_order[0]= R->i;
+ R_order[1]= R->j;
+ R_order[2]= R->k;
+
+ for(i= 0; i<3; i++) {
+ tvec[0]= tvec[1]= tvec[2]= 0.0f;
+ tvec[i] = 1.0f;
+
+ VecCopyf(teul, eul);
+
+ for(a= R_order2[i]; a >= 1; a--)
+ teul[R_order[a-1]]= 0.0f;
+
+ EulOToQuat(teul, order, quat);
+ NormalQuat(quat);
+ QuatMulVecf(quat, tvec);
+ Normalize(tvec);
+
+ VecCopyf(gmat[i], tvec);
+ }
+
+
+#if 0
+
+ for(i= 0; i<3; i++) {
+ tvec[0]= tvec[1]= tvec[2]= 0.0f;
+ tvec[i] = 1.0f;
+
+ VecCopyf(teul, eul);
+
+ for(a= R_order2[i]; a >= 1; a--)
+ teul[R_order[a-1]]= 0.0f;
+
+ EulToQuat(teul, quat);
+ NormalQuat(quat);
+ QuatMulVecf(quat, tvec);
+ Normalize(tvec);
+
+ VecCopyf(gmat[i], tvec);
+ }
+#endif
+
+
+
+
+}
+
/* ************ AXIS ANGLE *************** */
/* Axis angle to Quaternions */