From 97f0555cb0674ed161be012100af3541b95a5877 Mon Sep 17 00:00:00 2001 From: Verte <105466627+vertesians@users.noreply.github.com> Date: Sat, 30 Mar 2024 17:18:52 +0000 Subject: [PATCH] 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. --- crates/bevy_math/src/common_traits.rs | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/crates/bevy_math/src/common_traits.rs b/crates/bevy_math/src/common_traits.rs index 3c8220335a..6074f25266 100644 --- a/crates/bevy_math/src/common_traits.rs +++ b/crates/bevy_math/src/common_traits.rs @@ -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 {