diff options
author | Daniel Genrich <daniel.genrich@gmx.net> | 2008-11-19 22:28:12 +0300 |
---|---|---|
committer | Daniel Genrich <daniel.genrich@gmx.net> | 2008-11-19 22:28:12 +0300 |
commit | 28da9ad12ee9ab22432401a5c9cd485df971323a (patch) | |
tree | ae0a5773a38df61531beac365530acb037fa6a9f /source/blender/blenlib/intern/arithb.c | |
parent | 14a0718a8a4ed3ee95f6374e20dbe9e74cf3b5c6 (diff) | |
parent | f8e56e96bf2be4580dd34c33c6379339642638f0 (diff) |
svn merge -r 17201:17502 https://svn.blender.org/svnroot/bf-blender/trunk/blender
Diffstat (limited to 'source/blender/blenlib/intern/arithb.c')
-rw-r--r-- | source/blender/blenlib/intern/arithb.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/source/blender/blenlib/intern/arithb.c b/source/blender/blenlib/intern/arithb.c index bf7e3473d1f..5cfee8bf784 100644 --- a/source/blender/blenlib/intern/arithb.c +++ b/source/blender/blenlib/intern/arithb.c @@ -1351,8 +1351,8 @@ void Mat4ToQuat( float m[][4], float *q) void QuatOne(float *q) { - q[0]= q[2]= q[3]= 0.0; - q[1]= 1.0; + q[0]= 1.0; + q[1]= q[2]= q[3]= 0.0; } void NormalQuat(float *q) @@ -1371,6 +1371,18 @@ void NormalQuat(float *q) } } +void RotationBetweenVectorsToQuat(float *q, float v1[3], float v2[3]) +{ + float axis[3]; + float angle; + + Crossf(axis, v1, v2); + + angle = NormalizedVecAngle2(v1, v2); + + AxisAngleToQuat(q, axis, angle); +} + void AxisAngleToQuat(float *q, float *axis, float angle) { float nor[3]; @@ -2226,6 +2238,11 @@ int VecEqual(float *v1, float *v2) return ((v1[0]==v2[0]) && (v1[1]==v2[1]) && (v1[2]==v2[2])); } +int VecIsNull(float *v) +{ + return (v[0] == 0 && v[1] == 0 && v[2] == 0); +} + void CalcNormShort( short *v1, short *v2, short *v3, float *n) /* is also cross product */ { float n1[3],n2[3]; |