avoid negative zero when not needed
This commit is contained in:
parent
6b6c2548c5
commit
491e2ec0b2
|
@ -574,7 +574,7 @@ end function qu2cu
|
||||||
|
|
||||||
!---------------------------------------------------------------------------------------------------
|
!---------------------------------------------------------------------------------------------------
|
||||||
!> @author Martin Diehl, Max-Planck-Institut für Eisenforschung GmbH
|
!> @author Martin Diehl, Max-Planck-Institut für Eisenforschung GmbH
|
||||||
!> @brief convert rotation matrix to cubochoric
|
!> @brief convert rotation matrix to unit quaternion
|
||||||
!> @details the original formulation (direct conversion) had (numerical?) issues
|
!> @details the original formulation (direct conversion) had (numerical?) issues
|
||||||
!---------------------------------------------------------------------------------------------------
|
!---------------------------------------------------------------------------------------------------
|
||||||
pure function om2qu(om) result(qu)
|
pure function om2qu(om) result(qu)
|
||||||
|
@ -601,14 +601,14 @@ pure function om2qu(om) result(qu)
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
if(sign(1.0_pReal,qu(1))<0.0_pReal) qu =-1.0_pReal * qu
|
if(sign(1.0_pReal,qu(1))<0.0_pReal) qu =-1.0_pReal * qu
|
||||||
qu = qu*[1.0_pReal,P,P,P]
|
qu(2:4) = merge(qu(2:4),qu(2:4)*P,dEq0(qu(2:4)))
|
||||||
|
|
||||||
end function om2qu
|
end function om2qu
|
||||||
|
|
||||||
|
|
||||||
!---------------------------------------------------------------------------------------------------
|
!---------------------------------------------------------------------------------------------------
|
||||||
!> @author Marc De Graef, Carnegie Mellon University
|
!> @author Marc De Graef, Carnegie Mellon University
|
||||||
!> @brief orientation matrix to Euler angles
|
!> @brief convert orientation matrix to Euler angles
|
||||||
!> @details Two step check for special cases to avoid invalid operations (not needed for python)
|
!> @details Two step check for special cases to avoid invalid operations (not needed for python)
|
||||||
!---------------------------------------------------------------------------------------------------
|
!---------------------------------------------------------------------------------------------------
|
||||||
pure function om2eu(om) result(eu)
|
pure function om2eu(om) result(eu)
|
||||||
|
@ -1333,8 +1333,8 @@ pure function cu2ho(cu) result(ho)
|
||||||
! transform to sphere grid (inverse Lambert)
|
! transform to sphere grid (inverse Lambert)
|
||||||
! [note that there is no need to worry about dividing by zero, since XYZ(3) can not become zero]
|
! [note that there is no need to worry about dividing by zero, since XYZ(3) can not become zero]
|
||||||
c = sum(T**2)
|
c = sum(T**2)
|
||||||
s = PI * c/(24.0*XYZ(3)**2)
|
s = c * PI/(24.0*XYZ(3)**2)
|
||||||
c = sqrt(PI) * c / sqrt(24.0_pReal) / XYZ(3)
|
c = c * sqrt(PI/24.0_pReal) / XYZ(3)
|
||||||
q = sqrt( 1.0 - s )
|
q = sqrt( 1.0 - s )
|
||||||
LamXYZ = [ T(order(2)) * q, T(order(1)) * q, PREF * XYZ(3) - c ]
|
LamXYZ = [ T(order(2)) * q, T(order(1)) * q, PREF * XYZ(3) - c ]
|
||||||
end if special
|
end if special
|
||||||
|
|
Loading…
Reference in New Issue