File tree Expand file tree Collapse file tree 1 file changed +3
-8
lines changed Expand file tree Collapse file tree 1 file changed +3
-8
lines changed Original file line number Diff line number Diff line change @@ -446,18 +446,13 @@ extension Quaternion: Hashable {
446
446
// representation. The correct behavior for zero falls out for free from
447
447
// the hash behavior of floating-point, but we need to use a
448
448
// representative member for any non-finite values.
449
- // For any values not zero and infinity we use a canonical form, so
450
- // that q and -q hash to the same value . This allows people who are using
449
+ // For any normal values we use the " canonical transform" representation,
450
+ // where real is always non-negative . This allows people who are using
451
451
// quaternions as rotations to get the expected semantics out of collections
452
452
// (while unfortunately producing some collisions for people who are not,
453
453
// but not in too catastrophic of a fashion).
454
454
if isFinite {
455
- let absolute = SIMD4 (
456
- x: abs ( components [ 0 ] ) ,
457
- y: abs ( components [ 1 ] ) ,
458
- z: abs ( components [ 2 ] ) ,
459
- w: abs ( components [ 3 ] ) )
460
- absolute. hash ( into: & hasher)
455
+ transformCanonicalized. hash ( into: & hasher)
461
456
} else {
462
457
hasher. combine ( RealType . infinity)
463
458
}
You can’t perform that action at this time.
0 commit comments