From 2bb9d5471e1c43ebb1ec805648536edac9f78105 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Sat, 18 Nov 2006 23:07:32 +0000 Subject: Fix for bug #5250: inaccurate conversion between edit and pose mode bones. Using acos(dot(u, v)) to find the angle between two vectors is quite inaccurate, and there's a better way to do it, as explained here: http://www.plunk.org/~hatch/rightway.php Also changed the use of atan for computing roll to atan2 in some places, the latter avoids accuracy and division by zero issues. --- source/blender/python/api2_2x/Bone.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/blender/python/api2_2x/Bone.c') diff --git a/source/blender/python/api2_2x/Bone.c b/source/blender/python/api2_2x/Bone.c index 0d6594e2aef..e00ccd00477 100644 --- a/source/blender/python/api2_2x/Bone.c +++ b/source/blender/python/api2_2x/Bone.c @@ -69,7 +69,7 @@ static double boneRoll_ToArmatureSpace(struct Bone *bone) Mat3Inv(imat, postmat); Mat3MulMat3(difmat, imat, premat); - roll = atan(difmat[2][0] / difmat[2][2]); + roll = atan2(difmat[2][0], difmat[2][2]); if (difmat[0][0] < 0.0){ roll += M_PI; } -- cgit v1.2.3