fixed RotationAngle to return correct results for all
rotation matrices.

fixed log to use R^2 instead of R when angles are near pi
to avoid the divide by small numbers problem.