safe use of acos function in math_QuaternionToAxisAngle

This commit is contained in:
Christoph Kords 2010-04-29 10:33:39 +00:00
parent 15e5dcf8f2
commit 8ab101da50
1 changed files with 1 additions and 1 deletions

View File

@ -1386,7 +1386,7 @@ pure function math_transpose3x3(A)
real(pReal) halfAngle, sinHalfAngle
real(pReal), dimension(4) :: math_QuaternionToAxisAngle
halfAngle = dacos(Q(1)) ! value range 0 to 180 deg
halfAngle = dacos(max(-1.0_pReal, min(1.0_pReal, Q(1)))) ! value range 0 to 180 deg
sinHalfAngle = dsin(halfAngle)
if (sinHalfAngle <= 1.0e-4_pReal) then ! very small rotation angle?