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.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user