Fix nalgebra implementor.
Point must be removed because it is not additive.
This commit is contained in:
parent
bdb9a68c3b
commit
3d0a0c570e
@ -21,3 +21,9 @@ script:
|
|||||||
- cargo test --verbose --features serialization
|
- cargo test --verbose --features serialization
|
||||||
- echo "Building without std"
|
- echo "Building without std"
|
||||||
- cargo build --verbose --no-default-features
|
- cargo build --verbose --no-default-features
|
||||||
|
- echo "Testing with cgmath"
|
||||||
|
- cargo build --verbose --features impl-cgmath
|
||||||
|
- cargo test --verbose --features impl-cgmath
|
||||||
|
- echo "Testing with nalgebra"
|
||||||
|
- cargo build --verbose --features impl-nalgebra
|
||||||
|
- cargo test --verbose --features impl-nalgebra
|
||||||
|
@ -1,9 +1,5 @@
|
|||||||
use alga::general::{ClosedAdd, ClosedDiv, ClosedMul, ClosedSub};
|
use alga::general::{ClosedAdd, ClosedDiv, ClosedMul, ClosedSub};
|
||||||
use nalgebra::{
|
use nalgebra::{Scalar, Vector, Vector1, Vector2, Vector3, Vector4, Vector5, Vector6};
|
||||||
DefaultAllocator, DimName, Point, Scalar, Vector, Vector1, Vector2, Vector3, Vector4, Vector5,
|
|
||||||
Vector6
|
|
||||||
};
|
|
||||||
use nalgebra::allocator::Allocator;
|
|
||||||
use num_traits as nt;
|
use num_traits as nt;
|
||||||
use std::ops::Mul;
|
use std::ops::Mul;
|
||||||
|
|
||||||
@ -12,7 +8,7 @@ use crate::interpolate::{Interpolate, Linear, Additive, One, cubic_hermite_def};
|
|||||||
macro_rules! impl_interpolate_vector {
|
macro_rules! impl_interpolate_vector {
|
||||||
($($t:tt)*) => {
|
($($t:tt)*) => {
|
||||||
// implement Linear
|
// implement Linear
|
||||||
impl<T> Linear<T> for $($t)*<T> where T: Scalar + ClosedMul + ClosedDiv {
|
impl<T> Linear<T> for $($t)*<T> where T: Scalar + ClosedAdd + ClosedSub + ClosedMul + ClosedDiv {
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
fn outer_mul(self, t: T) -> Self {
|
fn outer_mul(self, t: T) -> Self {
|
||||||
self * t
|
self * t
|
||||||
@ -54,19 +50,3 @@ impl_interpolate_vector!(Vector3);
|
|||||||
impl_interpolate_vector!(Vector4);
|
impl_interpolate_vector!(Vector4);
|
||||||
impl_interpolate_vector!(Vector5);
|
impl_interpolate_vector!(Vector5);
|
||||||
impl_interpolate_vector!(Vector6);
|
impl_interpolate_vector!(Vector6);
|
||||||
|
|
||||||
impl<T, D> Linear<T> for Point<T, D>
|
|
||||||
where D: DimName,
|
|
||||||
DefaultAllocator: Allocator<T, D>,
|
|
||||||
<DefaultAllocator as Allocator<T, D>>::Buffer: Copy,
|
|
||||||
T: Scalar + ClosedDiv + ClosedMul {
|
|
||||||
#[inline(always)]
|
|
||||||
fn outer_mul(self, t: T) -> Self {
|
|
||||||
self * t
|
|
||||||
}
|
|
||||||
|
|
||||||
#[inline(always)]
|
|
||||||
fn outer_div(self, t: T) -> Self {
|
|
||||||
self / t
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user