fix rfc 1214 fallout
This commit is contained in:
parent
aebe5fd9bf
commit
0469935161
4 changed files with 22 additions and 22 deletions
|
@ -323,7 +323,7 @@ impl<S: Copy + Neg<Output = S>> Matrix4<S> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait Matrix<S: BaseFloat, V: Clone + Vector<S>>: Array2<V, V, S>
|
pub trait Matrix<S: BaseFloat, V: Clone + Vector<S> + 'static>: Array2<V, V, S>
|
||||||
+ Zero + One
|
+ Zero + One
|
||||||
+ ApproxEq<S>
|
+ ApproxEq<S>
|
||||||
+ Sized {
|
+ Sized {
|
||||||
|
|
|
@ -65,7 +65,7 @@ pub fn ortho<S: BaseFloat + 'static>(left: S, right: S, bottom: S, top: S, near:
|
||||||
}.into()
|
}.into()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait Projection<S>: Into<Matrix4<S>> {
|
pub trait Projection<S: BaseFloat>: Into<Matrix4<S>> {
|
||||||
fn to_frustum(&self) -> Frustum<S>;
|
fn to_frustum(&self) -> Frustum<S>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ use approx::ApproxEq;
|
||||||
use matrix::Matrix;
|
use matrix::Matrix;
|
||||||
use matrix::Matrix2;
|
use matrix::Matrix2;
|
||||||
use matrix::Matrix3;
|
use matrix::Matrix3;
|
||||||
use num::{BaseNum, BaseFloat};
|
use num::BaseFloat;
|
||||||
use point::{Point, Point2, Point3};
|
use point::{Point, Point2, Point3};
|
||||||
use quaternion::Quaternion;
|
use quaternion::Quaternion;
|
||||||
use ray::Ray;
|
use ray::Ray;
|
||||||
|
@ -26,7 +26,7 @@ use vector::{Vector, Vector2, Vector3};
|
||||||
|
|
||||||
/// A trait for a generic rotation. A rotation is a transformation that
|
/// 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.
|
/// 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).
|
/// Create the identity transform (causes no transformation).
|
||||||
fn identity() -> Self;
|
fn identity() -> Self;
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ pub trait Rotation<S: BaseNum, V: Vector<S>, P: Point<S, V>>: PartialEq + Approx
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A two-dimensional rotation.
|
/// A two-dimensional rotation.
|
||||||
pub trait Rotation2<S>: Rotation<S, Vector2<S>, Point2<S>>
|
pub trait Rotation2<S: BaseFloat>: Rotation<S, Vector2<S>, Point2<S>>
|
||||||
+ Into<Matrix2<S>>
|
+ Into<Matrix2<S>>
|
||||||
+ Into<Basis2<S>> {
|
+ Into<Basis2<S>> {
|
||||||
/// Create a rotation by a given angle. Thus is a redundant case of both
|
/// Create a rotation by a given angle. Thus is a redundant case of both
|
||||||
|
@ -83,7 +83,7 @@ pub trait Rotation2<S>: Rotation<S, Vector2<S>, Point2<S>>
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A three-dimensional rotation.
|
/// A three-dimensional rotation.
|
||||||
pub trait Rotation3<S: BaseNum>: Rotation<S, Vector3<S>, Point3<S>>
|
pub trait Rotation3<S: BaseFloat>: Rotation<S, Vector3<S>, Point3<S>>
|
||||||
+ Into<Matrix3<S>>
|
+ Into<Matrix3<S>>
|
||||||
+ Into<Basis3<S>>
|
+ Into<Basis3<S>>
|
||||||
+ Into<Quaternion<S>> {
|
+ Into<Quaternion<S>> {
|
||||||
|
|
|
@ -146,8 +146,8 @@ impl<
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait Transform2<S>: Transform<S, Vector2<S>, Point2<S>> + Into<Matrix3<S>> {}
|
pub trait Transform2<S: BaseNum>: Transform<S, Vector2<S>, Point2<S>> + Into<Matrix3<S>> {}
|
||||||
pub trait Transform3<S>: Transform<S, Vector3<S>, Point3<S>> + Into<Matrix4<S>> {}
|
pub trait Transform3<S: BaseNum>: Transform<S, Vector3<S>, Point3<S>> + Into<Matrix4<S>> {}
|
||||||
|
|
||||||
impl<
|
impl<
|
||||||
S: BaseFloat + 'static,
|
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)
|
/// A trait that allows extracting components (rotation, translation, scale)
|
||||||
/// from an arbitrary transformations
|
/// 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
|
/// Extract the (scale, rotation, translation) triple
|
||||||
fn decompose(&self) -> (V, R, V);
|
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> {}
|
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> {}
|
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> {}
|
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> {}
|
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> {}
|
Transform3<S> + ToComponents3<S, R> {}
|
||||||
|
|
||||||
impl<
|
impl<
|
||||||
|
|
Loading…
Reference in a new issue