diff options
author | Ton Roosendaal <ton@blender.org> | 2006-11-21 13:52:11 +0300 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2006-11-21 13:52:11 +0300 |
commit | efde6ecbc49dc44c0f2304ef67fc6ee1e399f0a4 (patch) | |
tree | cf55c1f486b6820bb8cbbfe629c474c15d94defe /source/blender/blenlib | |
parent | 823e71e7576ec916cdd8c81c5224a54edacafe44 (diff) |
Fix for commit from Brecht:
2006/11/19 00:07:32 CET
Fix for bug #5250: inaccurate conversion between edit and pose mode bones.
Two very bad bugs:
- replacing atan() with atan2() should also remove the M_PI correction!
This is the equivalent:
angle=atan(x/y); if(y<0) angle+=M_PI;
angle= atan2(x, y);
- the new NormalizedVecAngle2() call was negating an input vector, causing
calling code to screw up. All arithb.c calls should not alter input.
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r-- | source/blender/blenlib/intern/arithb.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/source/blender/blenlib/intern/arithb.c b/source/blender/blenlib/intern/arithb.c index 51000b3b155..fd91a4231f6 100644 --- a/source/blender/blenlib/intern/arithb.c +++ b/source/blender/blenlib/intern/arithb.c @@ -2418,11 +2418,13 @@ float NormalizedVecAngle2(float *v1, float *v2) { /* this is the same as acos(Inpf(v1, v2)), but more accurate */ if (Inpf(v1, v2) < 0.0f) { - v2[0]= -v2[0]; - v2[1]= -v2[1]; - v2[2]= -v2[2]; + float vec[3]; + + vec[0]= -v2[0]; + vec[1]= -v2[1]; + vec[2]= -v2[2]; - return (float)M_PI - 2.0f*saasin(VecLenf(v2, v1)/2.0f); + return (float)M_PI - 2.0f*saasin(VecLenf(vec, v1)/2.0f); } else return 2.0f*saasin(VecLenf(v2, v1)/2.0); |