Update to the last rust-nightly.
Version of rustc: 0.11.0-pre-nightly (918dbfe 2014-06-02 20:51:30 -0700).
This commit is contained in:
parent
f6c597f102
commit
5066d6b9de
|
@ -105,13 +105,13 @@ pub fn clamp<T: cmp::PartialOrd>(val: T, min: T, max: T) -> T {
|
||||||
|
|
||||||
/// Same as `cmp::max`.
|
/// Same as `cmp::max`.
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
pub fn max<T: TotalOrd>(a: T, b: T) -> T {
|
pub fn max<T: Ord>(a: T, b: T) -> T {
|
||||||
cmp::max(a, b)
|
cmp::max(a, b)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Same as `cmp::min`.
|
/// Same as `cmp::min`.
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
pub fn min<T: TotalOrd>(a: T, b: T) -> T {
|
pub fn min<T: Ord>(a: T, b: T) -> T {
|
||||||
cmp::min(a, b)
|
cmp::min(a, b)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ use std::fmt::{Show, Formatter, Result};
|
||||||
|
|
||||||
|
|
||||||
/// Matrix with dimensions unknown at compile-time.
|
/// Matrix with dimensions unknown at compile-time.
|
||||||
#[deriving(TotalEq, PartialEq, Clone)]
|
#[deriving(Eq, PartialEq, Clone)]
|
||||||
pub struct DMat<N> {
|
pub struct DMat<N> {
|
||||||
nrows: uint,
|
nrows: uint,
|
||||||
ncols: uint,
|
ncols: uint,
|
||||||
|
|
|
@ -12,7 +12,7 @@ use traits::geometry::{Dot, Norm};
|
||||||
use traits::structure::{Iterable, IterableMut, Indexable};
|
use traits::structure::{Iterable, IterableMut, Indexable};
|
||||||
|
|
||||||
/// Vector with a dimension unknown at compile-time.
|
/// Vector with a dimension unknown at compile-time.
|
||||||
#[deriving(TotalEq, PartialEq, Show, Clone)]
|
#[deriving(Eq, PartialEq, Show, Clone)]
|
||||||
pub struct DVec<N> {
|
pub struct DVec<N> {
|
||||||
/// Components of the vector. Contains as much elements as the vector dimension.
|
/// Components of the vector. Contains as much elements as the vector dimension.
|
||||||
pub at: Vec<N>
|
pub at: Vec<N>
|
||||||
|
|
|
@ -18,7 +18,7 @@ use structs::rot::{Rot2, Rot3, Rot4};
|
||||||
///
|
///
|
||||||
/// This is the composition of a rotation followed by a translation.
|
/// This is the composition of a rotation followed by a translation.
|
||||||
/// Isometries conserve angles and distances, hence do not allow shearing nor scaling.
|
/// Isometries conserve angles and distances, hence do not allow shearing nor scaling.
|
||||||
#[deriving(TotalEq, PartialEq, Encodable, Decodable, Clone, Show)]
|
#[deriving(Eq, PartialEq, Encodable, Decodable, Clone, Show)]
|
||||||
pub struct Iso2<N> {
|
pub struct Iso2<N> {
|
||||||
/// The rotation applicable by this isometry.
|
/// The rotation applicable by this isometry.
|
||||||
pub rotation: Rot2<N>,
|
pub rotation: Rot2<N>,
|
||||||
|
@ -30,7 +30,7 @@ pub struct Iso2<N> {
|
||||||
///
|
///
|
||||||
/// This is the composition of a rotation followed by a translation.
|
/// This is the composition of a rotation followed by a translation.
|
||||||
/// Isometries conserve angles and distances, hence do not allow shearing nor scaling.
|
/// Isometries conserve angles and distances, hence do not allow shearing nor scaling.
|
||||||
#[deriving(TotalEq, PartialEq, Encodable, Decodable, Clone, Show)]
|
#[deriving(Eq, PartialEq, Encodable, Decodable, Clone, Show)]
|
||||||
pub struct Iso3<N> {
|
pub struct Iso3<N> {
|
||||||
/// The rotation applicable by this isometry.
|
/// The rotation applicable by this isometry.
|
||||||
pub rotation: Rot3<N>,
|
pub rotation: Rot3<N>,
|
||||||
|
@ -41,7 +41,7 @@ pub struct Iso3<N> {
|
||||||
/// Four dimensional isometry.
|
/// Four dimensional isometry.
|
||||||
///
|
///
|
||||||
/// Isometries conserve angles and distances, hence do not allow shearing nor scaling.
|
/// Isometries conserve angles and distances, hence do not allow shearing nor scaling.
|
||||||
#[deriving(TotalEq, PartialEq, Encodable, Decodable, Clone, Show)]
|
#[deriving(Eq, PartialEq, Encodable, Decodable, Clone, Show)]
|
||||||
pub struct Iso4<N> {
|
pub struct Iso4<N> {
|
||||||
/// The rotation applicable by this isometry.
|
/// The rotation applicable by this isometry.
|
||||||
pub rotation: Rot4<N>,
|
pub rotation: Rot4<N>,
|
||||||
|
|
|
@ -17,7 +17,7 @@ use traits::geometry::{ToHomogeneous, FromHomogeneous};
|
||||||
|
|
||||||
|
|
||||||
/// Special identity matrix. All its operation are no-ops.
|
/// Special identity matrix. All its operation are no-ops.
|
||||||
#[deriving(TotalEq, PartialEq, Decodable, Clone, Rand, Show)]
|
#[deriving(Eq, PartialEq, Decodable, Clone, Rand, Show)]
|
||||||
pub struct Identity;
|
pub struct Identity;
|
||||||
|
|
||||||
impl Identity {
|
impl Identity {
|
||||||
|
@ -29,7 +29,7 @@ impl Identity {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Square matrix of dimension 1.
|
/// Square matrix of dimension 1.
|
||||||
#[deriving(TotalEq, PartialEq, Encodable, Decodable, Clone, Hash, Rand, Zero, Show)]
|
#[deriving(Eq, PartialEq, Encodable, Decodable, Clone, Hash, Rand, Zero, Show)]
|
||||||
pub struct Mat1<N> {
|
pub struct Mat1<N> {
|
||||||
pub m11: N
|
pub m11: N
|
||||||
}
|
}
|
||||||
|
@ -125,7 +125,7 @@ from_homogeneous_impl!(Mat1, Mat2, 1, 2)
|
||||||
outer_impl!(Vec1, Mat1)
|
outer_impl!(Vec1, Mat1)
|
||||||
|
|
||||||
/// Square matrix of dimension 2.
|
/// Square matrix of dimension 2.
|
||||||
#[deriving(TotalEq, PartialEq, Encodable, Decodable, Clone, Hash, Rand, Zero, Show)]
|
#[deriving(Eq, PartialEq, Encodable, Decodable, Clone, Hash, Rand, Zero, Show)]
|
||||||
pub struct Mat2<N> {
|
pub struct Mat2<N> {
|
||||||
pub m11: N, pub m21: N,
|
pub m11: N, pub m21: N,
|
||||||
pub m12: N, pub m22: N
|
pub m12: N, pub m22: N
|
||||||
|
@ -226,7 +226,7 @@ from_homogeneous_impl!(Mat2, Mat3, 2, 3)
|
||||||
outer_impl!(Vec2, Mat2)
|
outer_impl!(Vec2, Mat2)
|
||||||
|
|
||||||
/// Square matrix of dimension 3.
|
/// Square matrix of dimension 3.
|
||||||
#[deriving(TotalEq, PartialEq, Encodable, Decodable, Clone, Hash, Rand, Zero, Show)]
|
#[deriving(Eq, PartialEq, Encodable, Decodable, Clone, Hash, Rand, Zero, Show)]
|
||||||
pub struct Mat3<N> {
|
pub struct Mat3<N> {
|
||||||
pub m11: N, pub m21: N, pub m31: N,
|
pub m11: N, pub m21: N, pub m31: N,
|
||||||
pub m12: N, pub m22: N, pub m32: N,
|
pub m12: N, pub m22: N, pub m32: N,
|
||||||
|
@ -341,7 +341,7 @@ from_homogeneous_impl!(Mat3, Mat4, 3, 4)
|
||||||
outer_impl!(Vec3, Mat3)
|
outer_impl!(Vec3, Mat3)
|
||||||
|
|
||||||
/// Square matrix of dimension 4.
|
/// Square matrix of dimension 4.
|
||||||
#[deriving(TotalEq, PartialEq, Encodable, Decodable, Clone, Hash, Rand, Zero, Show)]
|
#[deriving(Eq, PartialEq, Encodable, Decodable, Clone, Hash, Rand, Zero, Show)]
|
||||||
pub struct Mat4<N> {
|
pub struct Mat4<N> {
|
||||||
pub m11: N, pub m21: N, pub m31: N, pub m41: N,
|
pub m11: N, pub m21: N, pub m31: N, pub m41: N,
|
||||||
pub m12: N, pub m22: N, pub m32: N, pub m42: N,
|
pub m12: N, pub m22: N, pub m32: N, pub m42: N,
|
||||||
|
@ -508,7 +508,7 @@ from_homogeneous_impl!(Mat4, Mat5, 4, 5)
|
||||||
outer_impl!(Vec4, Mat4)
|
outer_impl!(Vec4, Mat4)
|
||||||
|
|
||||||
/// Square matrix of dimension 5.
|
/// Square matrix of dimension 5.
|
||||||
#[deriving(TotalEq, PartialEq, Encodable, Decodable, Clone, Hash, Rand, Zero, Show)]
|
#[deriving(Eq, PartialEq, Encodable, Decodable, Clone, Hash, Rand, Zero, Show)]
|
||||||
pub struct Mat5<N> {
|
pub struct Mat5<N> {
|
||||||
pub m11: N, pub m21: N, pub m31: N, pub m41: N, pub m51: N,
|
pub m11: N, pub m21: N, pub m31: N, pub m41: N, pub m51: N,
|
||||||
pub m12: N, pub m22: N, pub m32: N, pub m42: N, pub m52: N,
|
pub m12: N, pub m22: N, pub m32: N, pub m42: N, pub m52: N,
|
||||||
|
@ -691,7 +691,7 @@ from_homogeneous_impl!(Mat5, Mat6, 5, 6)
|
||||||
outer_impl!(Vec5, Mat5)
|
outer_impl!(Vec5, Mat5)
|
||||||
|
|
||||||
/// Square matrix of dimension 6.
|
/// Square matrix of dimension 6.
|
||||||
#[deriving(TotalEq, PartialEq, Encodable, Decodable, Clone, Hash, Rand, Zero, Show)]
|
#[deriving(Eq, PartialEq, Encodable, Decodable, Clone, Hash, Rand, Zero, Show)]
|
||||||
pub struct Mat6<N> {
|
pub struct Mat6<N> {
|
||||||
pub m11: N, pub m21: N, pub m31: N, pub m41: N, pub m51: N, pub m61: N,
|
pub m11: N, pub m21: N, pub m31: N, pub m41: N, pub m51: N, pub m61: N,
|
||||||
pub m12: N, pub m22: N, pub m32: N, pub m42: N, pub m52: N, pub m62: N,
|
pub m12: N, pub m22: N, pub m32: N, pub m42: N, pub m52: N, pub m62: N,
|
||||||
|
|
|
@ -13,7 +13,7 @@ use structs::mat::{Mat2, Mat3, Mat4, Mat5};
|
||||||
|
|
||||||
|
|
||||||
/// Two dimensional rotation matrix.
|
/// Two dimensional rotation matrix.
|
||||||
#[deriving(TotalEq, PartialEq, Encodable, Decodable, Clone, Show, Hash)]
|
#[deriving(Eq, PartialEq, Encodable, Decodable, Clone, Show, Hash)]
|
||||||
pub struct Rot2<N> {
|
pub struct Rot2<N> {
|
||||||
submat: Mat2<N>
|
submat: Mat2<N>
|
||||||
}
|
}
|
||||||
|
@ -91,7 +91,7 @@ impl<N: Signed> AbsoluteRotate<Vec2<N>> for Rot2<N> {
|
||||||
* 3d rotation
|
* 3d rotation
|
||||||
*/
|
*/
|
||||||
/// Three dimensional rotation matrix.
|
/// Three dimensional rotation matrix.
|
||||||
#[deriving(TotalEq, PartialEq, Encodable, Decodable, Clone, Show, Hash)]
|
#[deriving(Eq, PartialEq, Encodable, Decodable, Clone, Show, Hash)]
|
||||||
pub struct Rot3<N> {
|
pub struct Rot3<N> {
|
||||||
submat: Mat3<N>
|
submat: Mat3<N>
|
||||||
}
|
}
|
||||||
|
@ -262,7 +262,7 @@ impl<N: Signed> AbsoluteRotate<Vec3<N>> for Rot3<N> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Four dimensional rotation matrix.
|
/// Four dimensional rotation matrix.
|
||||||
#[deriving(TotalEq, PartialEq, Encodable, Decodable, Clone, Show, Hash)]
|
#[deriving(Eq, PartialEq, Encodable, Decodable, Clone, Show, Hash)]
|
||||||
pub struct Rot4<N> {
|
pub struct Rot4<N> {
|
||||||
submat: Mat4<N>
|
submat: Mat4<N>
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,11 +14,11 @@ use traits::structure::{Basis, Cast, Dim, Indexable, Iterable, IterableMut};
|
||||||
|
|
||||||
|
|
||||||
/// Vector of dimension 0.
|
/// Vector of dimension 0.
|
||||||
#[deriving(TotalEq, PartialEq, Decodable, Clone, Rand, Zero, Show)]
|
#[deriving(Eq, PartialEq, Decodable, Clone, Rand, Zero, Show)]
|
||||||
pub struct Vec0<N>;
|
pub struct Vec0<N>;
|
||||||
|
|
||||||
/// Vector of dimension 1.
|
/// Vector of dimension 1.
|
||||||
#[deriving(TotalEq, PartialEq, Encodable, Decodable, Clone, Hash, Rand, Zero, Show)]
|
#[deriving(Eq, PartialEq, Encodable, Decodable, Clone, Hash, Rand, Zero, Show)]
|
||||||
pub struct Vec1<N> {
|
pub struct Vec1<N> {
|
||||||
/// First component of the vector.
|
/// First component of the vector.
|
||||||
pub x: N
|
pub x: N
|
||||||
|
@ -113,7 +113,7 @@ rotate_impl!(Vec1)
|
||||||
transform_impl!(Vec1)
|
transform_impl!(Vec1)
|
||||||
|
|
||||||
/// Vector of dimension 2.
|
/// Vector of dimension 2.
|
||||||
#[deriving(TotalEq, PartialEq, Encodable, Decodable, Clone, Hash, Rand, Zero, Show)]
|
#[deriving(Eq, PartialEq, Encodable, Decodable, Clone, Hash, Rand, Zero, Show)]
|
||||||
pub struct Vec2<N> {
|
pub struct Vec2<N> {
|
||||||
/// First component of the vector.
|
/// First component of the vector.
|
||||||
pub x: N,
|
pub x: N,
|
||||||
|
@ -210,7 +210,7 @@ rotate_impl!(Vec2)
|
||||||
transform_impl!(Vec2)
|
transform_impl!(Vec2)
|
||||||
|
|
||||||
/// Vector of dimension 3.
|
/// Vector of dimension 3.
|
||||||
#[deriving(TotalEq, PartialEq, Encodable, Decodable, Clone, Hash, Rand, Zero, Show)]
|
#[deriving(Eq, PartialEq, Encodable, Decodable, Clone, Hash, Rand, Zero, Show)]
|
||||||
pub struct Vec3<N> {
|
pub struct Vec3<N> {
|
||||||
/// First component of the vector.
|
/// First component of the vector.
|
||||||
pub x: N,
|
pub x: N,
|
||||||
|
@ -313,7 +313,7 @@ transform_impl!(Vec3)
|
||||||
|
|
||||||
|
|
||||||
/// Vector of dimension 4.
|
/// Vector of dimension 4.
|
||||||
#[deriving(TotalEq, PartialEq, Encodable, Decodable, Clone, Hash, Rand, Zero, Show)]
|
#[deriving(Eq, PartialEq, Encodable, Decodable, Clone, Hash, Rand, Zero, Show)]
|
||||||
pub struct Vec4<N> {
|
pub struct Vec4<N> {
|
||||||
/// First component of the vector.
|
/// First component of the vector.
|
||||||
pub x: N,
|
pub x: N,
|
||||||
|
@ -414,7 +414,7 @@ rotate_impl!(Vec4)
|
||||||
transform_impl!(Vec4)
|
transform_impl!(Vec4)
|
||||||
|
|
||||||
/// Vector of dimension 5.
|
/// Vector of dimension 5.
|
||||||
#[deriving(TotalEq, PartialEq, Encodable, Decodable, Clone, Hash, Rand, Zero, Show)]
|
#[deriving(Eq, PartialEq, Encodable, Decodable, Clone, Hash, Rand, Zero, Show)]
|
||||||
pub struct Vec5<N> {
|
pub struct Vec5<N> {
|
||||||
/// First component of the vector.
|
/// First component of the vector.
|
||||||
pub x: N,
|
pub x: N,
|
||||||
|
@ -517,7 +517,7 @@ rotate_impl!(Vec5)
|
||||||
transform_impl!(Vec5)
|
transform_impl!(Vec5)
|
||||||
|
|
||||||
/// Vector of dimension 6.
|
/// Vector of dimension 6.
|
||||||
#[deriving(TotalEq, PartialEq, Encodable, Decodable, Clone, Hash, Rand, Zero, Show)]
|
#[deriving(Eq, PartialEq, Encodable, Decodable, Clone, Hash, Rand, Zero, Show)]
|
||||||
pub struct Vec6<N> {
|
pub struct Vec6<N> {
|
||||||
/// First component of the vector.
|
/// First component of the vector.
|
||||||
pub x: N,
|
pub x: N,
|
||||||
|
|
|
@ -34,8 +34,8 @@ macro_rules! at_fast_impl(
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
// FIXME: N should be bounded by TotalOrd instead of Float…
|
// FIXME: N should be bounded by Ord instead of Float…
|
||||||
// However, f32/f64 does not implement TotalOrd…
|
// However, f32/f64 does not implement Ord…
|
||||||
macro_rules! ord_impl(
|
macro_rules! ord_impl(
|
||||||
($t: ident, $comp0: ident $(,$compN: ident)*) => (
|
($t: ident, $comp0: ident $(,$compN: ident)*) => (
|
||||||
impl<N: FloatMath + Clone> PartialOrd for $t<N> {
|
impl<N: FloatMath + Clone> PartialOrd for $t<N> {
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
|
|
||||||
/// Result of a partial ordering.
|
/// Result of a partial ordering.
|
||||||
#[deriving(TotalEq, PartialEq, Encodable, Decodable, Clone, Show)]
|
#[deriving(Eq, PartialEq, Encodable, Decodable, Clone, Show)]
|
||||||
pub enum PartialOrdering {
|
pub enum PartialOrdering {
|
||||||
/// Result of a strict comparison.
|
/// Result of a strict comparison.
|
||||||
PartialLess,
|
PartialLess,
|
||||||
|
|
Loading…
Reference in New Issue