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:
authorTon Roosendaal <ton@blender.org>2007-11-22 23:25:59 +0300
committerTon Roosendaal <ton@blender.org>2007-11-22 23:25:59 +0300
commita8aaec6f210626d2beb2d23f297c1a412b047e8e (patch)
tree95c8b7cce58431b7928a3e0a12b527d8f0828cb5 /source/blender/blenlib
parenta03836312463813e366f1043093625dafd3ebd2b (diff)
Bugfix #7573
NLA Window, Strip blending mode "Add" didn't work at all. It was using very bad quaternion addition. Replaced with proper code. For devs; new is the function QuatMulFac(quat, factor) which allows to multiply a rotation with a value (make it rotate more or less)
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r--source/blender/blenlib/BLI_arithb.h3
-rw-r--r--source/blender/blenlib/intern/arithb.c15
2 files changed, 17 insertions, 1 deletions
diff --git a/source/blender/blenlib/BLI_arithb.h b/source/blender/blenlib/BLI_arithb.h
index 9e4412d3cd3..32308f89a15 100644
--- a/source/blender/blenlib/BLI_arithb.h
+++ b/source/blender/blenlib/BLI_arithb.h
@@ -119,6 +119,8 @@ void QuatToEul(float *quat, float *eul);
void QuatOne(float *);
void QuatMul(float *, float *, float *);
void QuatMulVecf(float *q, float *v);
+void QuatMulf(float *q, float f);
+void QuatMulFac(float *q, float fac);
void NormalQuat(float *);
void VecRotToQuat(float *vec, float phi, float *quat);
@@ -126,7 +128,6 @@ void VecRotToQuat(float *vec, float phi, float *quat);
void QuatSub(float *q, float *q1, float *q2);
void QuatConj(float *q);
void QuatInv(float *q);
-void QuatMulf(float *q, float f);
float QuatDot(float *q1, float *q2);
void QuatCopy(float *q1, float *q2);
diff --git a/source/blender/blenlib/intern/arithb.c b/source/blender/blenlib/intern/arithb.c
index 5a37205af01..2888a684af1 100644
--- a/source/blender/blenlib/intern/arithb.c
+++ b/source/blender/blenlib/intern/arithb.c
@@ -1109,6 +1109,7 @@ void QuatInv(float *q)
QuatMulf(q, 1.0f/f);
}
+/* simple mult */
void QuatMulf(float *q, float f)
{
q[0] *= f;
@@ -1124,6 +1125,20 @@ void QuatSub(float *q, float *q1, float *q2)
q2[0]= -q2[0];
}
+/* angular mult factor */
+void QuatMulFac(float *q, float fac)
+{
+ float angle= fac*saacos(q[0]); /* quat[0]= cos(0.5*angle), but now the 0.5 and 2.0 rule out */
+
+ float co= (float)cos(angle);
+ float si= (float)sin(angle);
+ q[0]= co;
+ Normalize(q+1);
+ q[1]*= si;
+ q[2]*= si;
+ q[3]*= si;
+
+}
void QuatToMat3( float *q, float m[][3])
{