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 {
91
91
@inlinable
92
92
public var argument : RealType {
93
93
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 }
100
97
// If lengthSquared computes without over/underflow, everything is fine
101
98
// and the result is correct. If not, we have to do the computation
102
99
// carefully and unscale the quaternion first.
103
100
let lenSq = imaginary. lengthSquared
104
- guard lenSq. isNormal else { return divided ( by: magnitude) . argument }
101
+ guard lenSq. isNormal else { return divided ( by: magnitude) . halfAngle }
105
102
return . atan2( y: . sqrt( lenSq) , x: real)
106
103
}
107
104
You can’t perform that action at this time.
0 commit comments