Remove VectorSpace impl on Quat (#12796)

- Fixes #[12762](https://github.com/bevyengine/bevy/issues/12762).

## Migration Guide

- `Quat` no longer implements `VectorSpace` as unit quaternions don't
actually form proper vector spaces. If you're absolutely certain that
what you're doing is correct, convert the `Quat` into a `Vec4` and
perform the operations before converting back.
This commit is contained in:
Verte 2024-03-30 17:18:52 +00:00 committed by GitHub
parent 286bc8cce5
commit 97f0555cb0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,4 +1,4 @@
use glam::{Quat, Vec2, Vec3, Vec3A, Vec4};
use glam::{Vec2, Vec3, Vec3A, Vec4};
use std::fmt::Debug;
use std::ops::{Add, Div, Mul, Neg, Sub};
@ -47,11 +47,6 @@ pub trait VectorSpace:
}
}
// This is cursed and we should probably remove Quat from these.
impl VectorSpace for Quat {
const ZERO: Self = Quat::from_xyzw(0., 0., 0., 0.);
}
impl VectorSpace for Vec4 {
const ZERO: Self = Vec4::ZERO;
}
@ -107,18 +102,6 @@ pub trait NormedVectorSpace: VectorSpace {
}
}
impl NormedVectorSpace for Quat {
#[inline]
fn norm(self) -> f32 {
self.length()
}
#[inline]
fn norm_squared(self) -> f32 {
self.length_squared()
}
}
impl NormedVectorSpace for Vec4 {
#[inline]
fn norm(self) -> f32 {