From a165b7b68cb36c2c796882937bdab2beff08728a Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Wed, 23 Mar 2016 15:12:35 +0100 Subject: [PATCH] simplified statement --- code/math.f90 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/code/math.f90 b/code/math.f90 index bf7460062..624990ac4 100644 --- a/code/math.f90 +++ b/code/math.f90 @@ -1645,14 +1645,14 @@ pure function math_qToAxisAngle(Q) real(pReal) :: halfAngle, sinHalfAngle real(pReal), dimension(4) :: math_qToAxisAngle - halfAngle = acos(max(-1.0_pReal, min(1.0_pReal, Q(1)))) ! limit to [-1,1] --> 0 to 180 deg + halfAngle = acos(math_limit(Q(1),-1.0_pReal,1.0_pReal)) sinHalfAngle = sin(halfAngle) - if (sinHalfAngle <= 1.0e-4_pReal) then ! very small rotation angle? + smallRotation: if (sinHalfAngle <= 1.0e-4_pReal) then math_qToAxisAngle = 0.0_pReal - else + else smallRotation math_qToAxisAngle= [ Q(2:4)/sinHalfAngle, halfAngle*2.0_pReal] - endif + endif smallRotation end function math_qToAxisAngle