From 4ca1c1bbb1016ec07b7de110b319d1ee14a01c41 Mon Sep 17 00:00:00 2001 From: nsmryan Date: Sun, 30 Sep 2018 21:15:10 -0400 Subject: [PATCH] replaced matrix implementation with simpler vector instances for each of Vector1 through Vector6 --- src/lib.rs | 56 +++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 47 insertions(+), 9 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 1559605..efc07c6 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -409,18 +409,56 @@ impl Interpolate for na::Point } #[cfg(feature = "impl-nalgebra")] -impl Interpolate for na::Matrix>::Buffer> - where R : DimName, - C : DimName, - ::Value : Mul<::Value>, - ::Value : Mul<::Value>, - <::Value as Mul<::Value>>::Output : generic_array::ArrayLength, - <<::Value as Mul<::Value>>::Output as generic_array::ArrayLength>::ArrayType : Copy, +impl Interpolate for na::Vector1 { fn lerp(a: Self, b: Self, t: f32) -> Self { - let lerp = |c1 : f32, c2 : f32| Interpolate::lerp(c1, c2, t); - na::Matrix::zip_map(&a, &b, lerp) + na::Matrix::zip_map(&a, &b, |c1, c2| Interpolate::lerp(c1, c2, t)) + } +} + +#[cfg(feature = "impl-nalgebra")] +impl Interpolate for na::Vector2 +{ + fn lerp(a: Self, b: Self, t: f32) -> Self + { + na::Matrix::zip_map(&a, &b, |c1, c2| Interpolate::lerp(c1, c2, t)) + } +} + +#[cfg(feature = "impl-nalgebra")] +impl Interpolate for na::Vector3 +{ + fn lerp(a: Self, b: Self, t: f32) -> Self + { + na::Matrix::zip_map(&a, &b, |c1, c2| Interpolate::lerp(c1, c2, t)) + } +} + +#[cfg(feature = "impl-nalgebra")] +impl Interpolate for na::Vector4 +{ + fn lerp(a: Self, b: Self, t: f32) -> Self + { + na::Matrix::zip_map(&a, &b, |c1, c2| Interpolate::lerp(c1, c2, t)) + } +} + +#[cfg(feature = "impl-nalgebra")] +impl Interpolate for na::Vector5 +{ + fn lerp(a: Self, b: Self, t: f32) -> Self + { + na::Matrix::zip_map(&a, &b, |c1, c2| Interpolate::lerp(c1, c2, t)) + } +} + +#[cfg(feature = "impl-nalgebra")] +impl Interpolate for na::Vector6 +{ + fn lerp(a: Self, b: Self, t: f32) -> Self + { + na::Matrix::zip_map(&a, &b, |c1, c2| Interpolate::lerp(c1, c2, t)) } }