Skip to content

Commit 0ff14df

Browse files
markuswntrstephentyrone
authored andcommitted
Rename half angle with phase to make it more distinct
1 parent 3f41acb commit 0ff14df

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

Sources/QuaternionModule/Transformation.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,8 @@ extension Quaternion {
121121

122122
/// The [polar decomposition][wiki].
123123
///
124-
/// Returns the length of this quaternion, half rotation angle in radians of
125-
/// *[0, π]* range and the rotation axis as SIMD3 vector of unit length.
124+
/// Returns the length of this quaternion, phase in radians of range *[0, π]*
125+
/// and the rotation axis as SIMD3 vector of unit length.
126126
///
127127
/// Edge cases:
128128
/// -
@@ -144,7 +144,7 @@ extension Quaternion {
144144
/// - `init(rotation:)`
145145
///
146146
/// [wiki]: https://en.wikipedia.org/wiki/Polar_decomposition#Quaternion_polar_decomposition
147-
public var polar: (length: RealType, halfAngle: RealType, axis: SIMD3<RealType>) {
147+
public var polar: (length: RealType, phase: RealType, axis: SIMD3<RealType>) {
148148
(length, halfAngle, axis)
149149
}
150150

@@ -257,11 +257,11 @@ extension Quaternion {
257257

258258
/// Creates a quaternion specified with [polar coordinates][wiki].
259259
///
260-
/// This initializer reads given `length`, `halfAngle` and `axis` values and
260+
/// This initializer reads given `length`, `phase` and `axis` values and
261261
/// creates a quaternion of equal rotation properties and specified *length*
262262
/// using the following equation:
263263
///
264-
/// Q = (cos(halfAngle), axis * sin(halfAngle)) * length
264+
/// Q = (cos(phase), axis * sin(phase)) * length
265265
///
266266
/// Given `axis` gets normalized if it is not of unit length.
267267
///
@@ -293,11 +293,11 @@ extension Quaternion {
293293
///
294294
/// [wiki]: https://en.wikipedia.org/wiki/Polar_decomposition#Quaternion_polar_decomposition
295295
@inlinable
296-
public init(length: RealType, halfAngle: RealType, axis: SIMD3<RealType>) {
296+
public init(length: RealType, phase: RealType, axis: SIMD3<RealType>) {
297297
let axisLength: RealType = .sqrt(axis.lengthSquared)
298-
if halfAngle.isFinite && axisLength.isNormal {
298+
if phase.isFinite && axisLength.isNormal {
299299
self = Quaternion(
300-
halfAngle: halfAngle,
300+
halfAngle: phase,
301301
unitAxis: axis/axisLength
302302
).multiplied(by: length)
303303
} else {

0 commit comments

Comments
 (0)