1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
extern crate rustc_serialize;
extern crate num;
extern crate rand;
extern crate nalgebra as na;
use std::f32;
use std::f64;
use rustc_serialize::{Encodable, Decodable};
use rand::Rand;
use std::fmt::Debug;
use std::ops::{IndexMut, Mul, Neg};
use std::any::Any;
use num::{Signed, One};
use na::{Pnt1, Pnt2, Pnt3, Vec1, Vec2, Vec3, Mat1, Mat3, Iso2, Iso3, Identity};
use na::{ApproxEq, Cast, POrd, FloatVec, Translate, UniformSphereSample,
Rotate, Transform, AbsoluteRotate, Inv, FloatPnt, Shape, Absolute, Iterable, BaseFloat,
Bounded, Repeat};
pub trait FloatError {
fn epsilon() -> Self;
}
pub trait Scalar: Copy + Send + Sync + 'static + Debug + Signed +
BaseFloat + ApproxEq<Self> + Cast<f64> + Rand + Bounded +
FloatError + Decodable + Encodable + Any {
}
pub trait Point: Send + Sync + 'static + Clone + Copy + Debug +
FloatPnt<<<Self as Point>::Vect as Vect>::Scalar, <Self as Point>::Vect> +
POrd +
Bounded +
IndexMut<usize, Output = <<Self as Point>::Vect as Vect>::Scalar> +
Neg<Output = Self> +
Decodable + Encodable +
Repeat<<<Self as Point>::Vect as Vect>::Scalar> +
Any {
type Vect: Vect;
}
pub trait Vect: Send + Sync + 'static +
FloatVec<<Self as Vect>::Scalar> + UniformSphereSample + Clone +
IndexMut<usize, Output = <Self as Vect>::Scalar> + Rand + Shape<usize> +
POrd + Absolute<Self> + Iterable<<Self as Vect>::Scalar> +
Copy + Neg<Output = Self> + Debug + Any + Decodable + Encodable +
Repeat<<Self as Vect>::Scalar> {
type Scalar: Scalar;
}
pub trait Isometry<P, V>:
Send + Sync + 'static +
One + Rotate<V> +
Translate<P> + Transform<P> + AbsoluteRotate<V> +
Inv + Clone + Mul<Self, Output = Self> +
Copy + Debug + Any +
Decodable + Encodable {
}
pub trait HasInertiaMatrix<I> { }
impl FloatError for f32 {
fn epsilon() -> f32 {
f32::EPSILON
}
}
impl FloatError for f64 {
fn epsilon() -> f64 {
f64::EPSILON
}
}
impl Scalar for f32 { }
impl Scalar for f64 { }
impl<N: Scalar> Point for Pnt1<N> { type Vect = Vec1<N>; }
impl<N: Scalar> Point for Pnt2<N> { type Vect = Vec2<N>; }
impl<N: Scalar> Point for Pnt3<N> { type Vect = Vec3<N>; }
impl<N: Scalar> Vect for Vec1<N> { type Scalar = N; }
impl<N: Scalar> Vect for Vec2<N> { type Scalar = N; }
impl<N: Scalar> Vect for Vec3<N> { type Scalar = N; }
impl<N: Scalar> Isometry<Pnt2<N>, Vec2<N>> for Iso2<N> { }
impl<N: Scalar> Isometry<Pnt3<N>, Vec3<N>> for Iso3<N> { }
impl<N: Scalar> Isometry<Pnt2<N>, Vec2<N>> for Identity { }
impl<N: Scalar> Isometry<Pnt3<N>, Vec3<N>> for Identity { }
impl<N> HasInertiaMatrix<Mat1<N>> for Vec2<N> { }
impl<N> HasInertiaMatrix<Mat3<N>> for Vec3<N> { }