mirror of
https://github.com/apple/swift-numerics
synced 2026-11-23 04:34:25 +00:00
1.7 KiB
1.7 KiB
Transformation
In computer science, quaternions are frequently used to represent three-dimensional rotations; as quaternions have some advantages over other representations.
Transformation.swift encapsulates an API to interact with the three-dimensional transformation properties of quaternions. It provides conversions to and from other rotation representations, namely Angle-Axis, Rotation Vector and Polar decomposition, as well as it provides methods to directly transform arbitrary vectors by quaternions.
Policies
-
zero and non-finite quaternions have indeterminate transformation properties and can not be converted to other representations. Thus,
- The
angleof.zeroor.infinityisRealType.nan. - The
axisof.zeroor.infinityisRealType.nanin all lanes. - The
rotationVectorof.zeroor.infinityisRealType.nanin all lanes.- The polar
phaseof.zeroor.infinityisRealType.nan
- The polar
- The
-
Quaternions with an
angleof.zerohave an indeterminate rotation axis. Thus,- the
axisofangle == .zeroisRealType.nanin all lanes. - the
rotationVectorofangle == .zeroisRealType.nanin all lanes.
- the