Skip to content

Commit

Permalink
cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
jsmith628 committed Mar 29, 2024
1 parent 0c343fd commit 7c191f0
Showing 1 changed file with 9 additions and 14 deletions.
23 changes: 9 additions & 14 deletions src/geometry/rotation_interpolation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ where
#[inline]
#[must_use]
pub fn slerp(&self, other: &Self, t: T) -> Self {

//The best option here would be to use #[feature(specialization)], but until
//that's stabilized, this is the best we can do. Theoretically, the compiler should
//pretty thoroughly optimize away all the excess checks and conversions
Expand All @@ -124,35 +125,29 @@ where

2 => {
let self2d = Rotation2::from_matrix_unchecked(
self.clone().into_inner().fixed_resize(T::zero()),
self.clone().into_inner().fixed_resize(T::zero())
);
let other2d = Rotation2::from_matrix_unchecked(
other.clone().into_inner().fixed_resize(T::zero()),
other.clone().into_inner().fixed_resize(T::zero())
);

Self::from_matrix_unchecked(
self2d
.slerp_2d(&other2d, t)
.into_inner()
.fixed_resize(T::zero()),
self2d.slerp_2d(&other2d, t).into_inner().fixed_resize(T::zero())
)
}
},

3 => {
let self3d = Rotation3::from_matrix_unchecked(
self.clone().into_inner().fixed_resize(T::zero()),
self.clone().into_inner().fixed_resize(T::zero())
);
let other3d = Rotation3::from_matrix_unchecked(
other.clone().into_inner().fixed_resize(T::zero()),
other.clone().into_inner().fixed_resize(T::zero())
);

Self::from_matrix_unchecked(
self3d
.slerp_3d(&other3d, t)
.into_inner()
.fixed_resize(T::zero()),
self3d.slerp_3d(&other3d, t).into_inner().fixed_resize(T::zero())
)
}
},

//the multiplication order matters here
_ => (other / self).powf(t) * self,
Expand Down

0 comments on commit 7c191f0

Please sign in to comment.