fix rfc 1214 fallout

This commit is contained in:
Tim Neumann 2015-09-12 13:07:22 +02:00
parent aebe5fd9bf
commit 0469935161
4 changed files with 22 additions and 22 deletions

View file

@ -323,10 +323,10 @@ impl<S: Copy + Neg<Output = S>> Matrix4<S> {
}
}
pub trait Matrix<S: BaseFloat, V: Clone + Vector<S>>: Array2<V, V, S>
+ Zero + One
+ ApproxEq<S>
+ Sized {
pub trait Matrix<S: BaseFloat, V: Clone + Vector<S> + 'static>: Array2<V, V, S>
+ Zero + One
+ ApproxEq<S>
+ Sized {
/// Multiply this matrix by a scalar, returning the new matrix.
#[must_use]
fn mul_s(&self, s: S) -> Self;

View file

@ -65,7 +65,7 @@ pub fn ortho<S: BaseFloat + 'static>(left: S, right: S, bottom: S, top: S, near:
}.into()
}
pub trait Projection<S>: Into<Matrix4<S>> {
pub trait Projection<S: BaseFloat>: Into<Matrix4<S>> {
fn to_frustum(&self) -> Frustum<S>;
}

View file

@ -18,7 +18,7 @@ use approx::ApproxEq;
use matrix::Matrix;
use matrix::Matrix2;
use matrix::Matrix3;
use num::{BaseNum, BaseFloat};
use num::BaseFloat;
use point::{Point, Point2, Point3};
use quaternion::Quaternion;
use ray::Ray;
@ -26,7 +26,7 @@ use vector::{Vector, Vector2, Vector3};
/// A trait for a generic rotation. A rotation is a transformation that
/// creates a circular motion, and preserves at least one point in the space.
pub trait Rotation<S: BaseNum, V: Vector<S>, P: Point<S, V>>: PartialEq + ApproxEq<S> + Sized {
pub trait Rotation<S: BaseFloat, V: Vector<S>, P: Point<S, V>>: PartialEq + ApproxEq<S> + Sized {
/// Create the identity transform (causes no transformation).
fn identity() -> Self;
@ -74,19 +74,19 @@ pub trait Rotation<S: BaseNum, V: Vector<S>, P: Point<S, V>>: PartialEq + Approx
}
/// A two-dimensional rotation.
pub trait Rotation2<S>: Rotation<S, Vector2<S>, Point2<S>>
+ Into<Matrix2<S>>
+ Into<Basis2<S>> {
pub trait Rotation2<S: BaseFloat>: Rotation<S, Vector2<S>, Point2<S>>
+ Into<Matrix2<S>>
+ Into<Basis2<S>> {
/// Create a rotation by a given angle. Thus is a redundant case of both
/// from_axis_angle() and from_euler() for 2D space.
fn from_angle(theta: Rad<S>) -> Self;
}
/// A three-dimensional rotation.
pub trait Rotation3<S: BaseNum>: Rotation<S, Vector3<S>, Point3<S>>
+ Into<Matrix3<S>>
+ Into<Basis3<S>>
+ Into<Quaternion<S>> {
pub trait Rotation3<S: BaseFloat>: Rotation<S, Vector3<S>, Point3<S>>
+ Into<Matrix3<S>>
+ Into<Basis3<S>>
+ Into<Quaternion<S>> {
/// Create a rotation using an angle around a given axis.
fn from_axis_angle(axis: &Vector3<S>, angle: Rad<S>) -> Self;

View file

@ -146,8 +146,8 @@ impl<
}
}
pub trait Transform2<S>: Transform<S, Vector2<S>, Point2<S>> + Into<Matrix3<S>> {}
pub trait Transform3<S>: Transform<S, Vector3<S>, Point3<S>> + Into<Matrix4<S>> {}
pub trait Transform2<S: BaseNum>: Transform<S, Vector2<S>, Point2<S>> + Into<Matrix3<S>> {}
pub trait Transform3<S: BaseNum>: Transform<S, Vector3<S>, Point3<S>> + Into<Matrix4<S>> {}
impl<
S: BaseFloat + 'static,
@ -239,21 +239,21 @@ impl<S: BaseFloat + 'static> Transform3<S> for AffineMatrix3<S> {}
/// A trait that allows extracting components (rotation, translation, scale)
/// from an arbitrary transformations
pub trait ToComponents<S: BaseNum, V: Vector<S>, P: Point<S, V>, R: Rotation<S, V, P>> {
pub trait ToComponents<S: BaseFloat, V: Vector<S>, P: Point<S, V>, R: Rotation<S, V, P>> {
/// Extract the (scale, rotation, translation) triple
fn decompose(&self) -> (V, R, V);
}
pub trait ToComponents2<S, R: Rotation2<S>>:
pub trait ToComponents2<S: BaseFloat, R: Rotation2<S>>:
ToComponents<S, Vector2<S>, Point2<S>, R> {}
pub trait ToComponents3<S, R: Rotation3<S>>:
pub trait ToComponents3<S: BaseFloat, R: Rotation3<S>>:
ToComponents<S, Vector3<S>, Point3<S>, R> {}
pub trait CompositeTransform<S, V: Vector<S>, P: Point<S, V>, R: Rotation<S, V, P>>:
pub trait CompositeTransform<S: BaseFloat, V: Vector<S>, P: Point<S, V>, R: Rotation<S, V, P>>:
Transform<S, V, P> + ToComponents<S, V, P, R> {}
pub trait CompositeTransform2<S, R: Rotation2<S>>:
pub trait CompositeTransform2<S: BaseFloat, R: Rotation2<S>>:
Transform2<S> + ToComponents2<S, R> {}
pub trait CompositeTransform3<S, R: Rotation3<S>>:
pub trait CompositeTransform3<S: BaseFloat, R: Rotation3<S>>:
Transform3<S> + ToComponents3<S, R> {}
impl<