File tree Expand file tree Collapse file tree 1 file changed +4
-7
lines changed Expand file tree Collapse file tree 1 file changed +4
-7
lines changed Original file line number Diff line number Diff line change @@ -91,17 +91,14 @@ extension Quaternion {
9191 @inlinable
9292 public var argument : RealType {
9393 guard isFinite else { return . nan }
94- guard imaginary != . zero else {
95- // A zero quaternion does not encode transformation properties.
96- // If imaginary is zero, real must be non-zero or nan is returned.
97- return real. isZero ? . nan : . zero
98- }
99-
94+ // A zero quaternion does not encode transformation properties.
95+ // If imaginary is zero, real must be non-zero or nan is returned.
96+ guard !isReal else { return isPure ? . nan : . zero }
10097 // If lengthSquared computes without over/underflow, everything is fine
10198 // and the result is correct. If not, we have to do the computation
10299 // carefully and unscale the quaternion first.
103100 let lenSq = imaginary. lengthSquared
104- guard lenSq. isNormal else { return divided ( by: magnitude) . argument }
101+ guard lenSq. isNormal else { return divided ( by: magnitude) . halfAngle }
105102 return . atan2( y: . sqrt( lenSq) , x: real)
106103 }
107104
You can’t perform that action at this time.
0 commit comments