Skip to content

Commit

Permalink
Remove normalized assertions from mul_quat
Browse files Browse the repository at this point in the history
  • Loading branch information
fu5ha committed Sep 9, 2024
1 parent f5dec1c commit dd2d86b
Show file tree
Hide file tree
Showing 7 changed files with 2 additions and 23 deletions.
7 changes: 2 additions & 5 deletions codegen/templates/quat.rs.tera
Original file line number Diff line number Diff line change
Expand Up @@ -711,7 +711,7 @@ impl {{ self_t }} {
glam_assert!(self.is_normalized() && rhs.is_normalized());
math::acos_approx(math::abs(self.dot(rhs))) * 2.0
}

/// Rotates towards `rhs` up to `max_angle` (in radians).
///
/// When `max_angle` is `0.0`, the result will be equal to `self`. When `max_angle` is equal to
Expand Down Expand Up @@ -775,7 +775,7 @@ impl {{ self_t }} {
{% if is_scalar %}
let dot = self.dot(end);
let bias = if dot >= 0.0 { 1.0 } else { -1.0 };
self.lerp_impl(end * bias, s)
self.lerp_impl(end * bias, s)
{% elif is_sse2 %}
const NEG_ZERO: __m128 = m128_from_f32x4([-0.0; 4]);
unsafe {
Expand Down Expand Up @@ -908,9 +908,6 @@ impl {{ self_t }} {
#[inline]
#[must_use]
pub fn mul_quat(self, rhs: Self) -> Self {
glam_assert!(self.is_normalized());
glam_assert!(rhs.is_normalized());

{% if is_scalar %}
let (x0, y0, z0, w0) = self.into();
let (x1, y1, z1, w1) = rhs.into();
Expand Down
3 changes: 0 additions & 3 deletions src/f32/coresimd/quat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -702,9 +702,6 @@ impl Quat {
#[inline]
#[must_use]
pub fn mul_quat(self, rhs: Self) -> Self {
glam_assert!(self.is_normalized());
glam_assert!(rhs.is_normalized());

let lhs = self.0;
let rhs = rhs.0;

Expand Down
3 changes: 0 additions & 3 deletions src/f32/neon/quat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -715,9 +715,6 @@ impl Quat {
#[inline]
#[must_use]
pub fn mul_quat(self, rhs: Self) -> Self {
glam_assert!(self.is_normalized());
glam_assert!(rhs.is_normalized());

unsafe {
let lhs = self.0;
let rhs = rhs.0;
Expand Down
3 changes: 0 additions & 3 deletions src/f32/scalar/quat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -716,9 +716,6 @@ impl Quat {
#[inline]
#[must_use]
pub fn mul_quat(self, rhs: Self) -> Self {
glam_assert!(self.is_normalized());
glam_assert!(rhs.is_normalized());

let (x0, y0, z0, w0) = self.into();
let (x1, y1, z1, w1) = rhs.into();
Self::from_xyzw(
Expand Down
3 changes: 0 additions & 3 deletions src/f32/sse2/quat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -725,9 +725,6 @@ impl Quat {
#[inline]
#[must_use]
pub fn mul_quat(self, rhs: Self) -> Self {
glam_assert!(self.is_normalized());
glam_assert!(rhs.is_normalized());

// Based on https://github.com/nfrechette/rtm `rtm::quat_mul`
const CONTROL_WZYX: __m128 = m128_from_f32x4([1.0, -1.0, 1.0, -1.0]);
const CONTROL_ZWXY: __m128 = m128_from_f32x4([1.0, 1.0, -1.0, -1.0]);
Expand Down
3 changes: 0 additions & 3 deletions src/f32/wasm32/quat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -702,9 +702,6 @@ impl Quat {
#[inline]
#[must_use]
pub fn mul_quat(self, rhs: Self) -> Self {
glam_assert!(self.is_normalized());
glam_assert!(rhs.is_normalized());

let lhs = self.0;
let rhs = rhs.0;

Expand Down
3 changes: 0 additions & 3 deletions src/f64/dquat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -698,9 +698,6 @@ impl DQuat {
#[inline]
#[must_use]
pub fn mul_quat(self, rhs: Self) -> Self {
glam_assert!(self.is_normalized());
glam_assert!(rhs.is_normalized());

let (x0, y0, z0, w0) = self.into();
let (x1, y1, z1, w1) = rhs.into();
Self::from_xyzw(
Expand Down

0 comments on commit dd2d86b

Please sign in to comment.