@@ -404,9 +404,9 @@ extension Quaternion: Hashable {
404
404
/// - Important:
405
405
/// Quaternions are frequently used to represent 3D transformations. It's
406
406
/// important to be aware that, when used this way, any quaternion and its
407
- /// negation represent the same transformation, but they do not compare equal
408
- /// using `==` because they are not the same quaternion.
409
- /// You can compare quaternions as 3D transformations using `transformEquals()`.
407
+ /// negation represent the same transformation, but they do not compare
408
+ /// equal using `==` because they are not the same quaternion. You can
409
+ /// compare quaternions as 3D transformations using `transformEquals()`.
410
410
@_transparent
411
411
public static func == ( lhs: Quaternion , rhs: Quaternion ) -> Bool {
412
412
// Identify all numbers with either component non-finite as a single "point at infinity".
@@ -418,21 +418,19 @@ extension Quaternion: Hashable {
418
418
return lhs. components == rhs. components
419
419
}
420
420
421
- /// Rotation equality comparison
421
+ /// Transformation equality comparison
422
422
///
423
- /// This method tests for rotation-wise equality in *R³*, where both `q == q`
424
- /// but also `q == -q` are `true `.
423
+ /// Returns a Boolean value indicating whether the 3D transformations of this
424
+ /// quaternion equals the 3D transformation of `other `.
425
425
///
426
- /// - Parameters:
427
- /// - other: The value to compare.
428
- /// - Returns: Boolean value indicating whether the rotation in *R³* of this
429
- /// quaternion equals the rotation of `other`.
426
+ /// - Parameter other: The value to compare.
427
+ /// - Returns: True if the transformation of this quaternion equals `other`.
430
428
@_transparent
431
- public func rotationEquals ( _ other: Quaternion ) -> Bool {
429
+ public func transformEquals ( _ other: Quaternion ) -> Bool {
432
430
// Identify all numbers with either component non-finite as a single "point at infinity".
433
431
guard isFinite || other. isFinite else { return true }
434
- // For finite numbers, equality is defined componentwise. Cases where
435
- // only one of lhs or rhs is infinite fall through to here as well, but this
432
+ // For finite numbers, equality is defined componentwise. Cases where only
433
+ // one of lhs or rhs is infinite fall through to here as well, but this
436
434
// expression correctly returns false for them so we don't need to handle
437
435
// them explicitly.
438
436
return components == other. components || components == - other. components
@@ -452,7 +450,7 @@ extension Quaternion: Hashable {
452
450
// (while unfortunately producing some collisions for people who are not,
453
451
// but not in too catastrophic of a fashion).
454
452
if isFinite {
455
- transformCanonicalized. hash ( into: & hasher)
453
+ transformCanonicalized. components . hash ( into: & hasher)
456
454
} else {
457
455
hasher. combine ( RealType . infinity)
458
456
}
0 commit comments