Add comments noting rust bugs

This commit is contained in:
Brendan Zabarauskas 2015-11-03 15:40:52 +11:00
parent cda76e3bbb
commit 89e656b1f6
6 changed files with 19 additions and 3 deletions

View file

@ -19,6 +19,7 @@ use std::ops::*;
/// An array containing elements of type `Element`
pub trait Array1 where
// FIXME: Ugly type signatures - blocked by rust-lang/rust#24092
Self: Index<usize, Output = <Self as Array1>::Element>,
Self: IndexMut<usize, Output = <Self as Array1>::Element>,
{
@ -50,6 +51,7 @@ pub trait Array1 where
/// A column-major array
pub trait Array2 where
// FIXME: Ugly type signatures - blocked by rust-lang/rust#24092
Self: Index<usize, Output = <Self as Array2>::Column>,
Self: IndexMut<usize, Output = <Self as Array2>::Column>,
{

View file

@ -250,6 +250,7 @@ impl<S: Copy + Neg<Output = S>> Matrix4<S> {
}
pub trait Matrix where
// FIXME: Ugly type signatures - blocked by rust-lang/rust#24092
Self: Array2<
Element = <<Self as Matrix>::ColumnRow as Vector>::Scalar,
Column = <Self as Matrix>::ColumnRow,
@ -268,6 +269,7 @@ pub trait Matrix where
// for<'a> &'a Self: Div<S, Output = Self>,
// for<'a> &'a Self: Rem<S, Output = Self>,
{
// FIXME: Will not be needed once equality constraints in where clauses is implemented
type ColumnRow: Vector;
/// Create a new diagonal matrix using the supplied value.

View file

@ -66,7 +66,9 @@ impl<S: BaseNum> Point3<S> {
}
/// Specifies the numeric operations for point types.
pub trait Point: Array1<Element = <<Self as Point>::Vector as Vector>::Scalar> + Clone // where
pub trait Point: Clone where
// FIXME: Ugly type signatures - blocked by rust-lang/rust#24092
Self: Array1<Element = <<Self as Point>::Vector as Vector>::Scalar>,
// FIXME: blocked by rust-lang/rust#20671
//
// for<'a, 'b> &'a Self: Add<&'b V, Output = Self>,

View file

@ -25,7 +25,9 @@ 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<P: Point>: PartialEq + ApproxEq<Epsilon = <<P as Point>::Vector as Vector>::Scalar> + Sized where
pub trait Rotation<P: Point>: PartialEq + Sized where
// FIXME: Ugly type signatures - blocked by rust-lang/rust#24092
Self: ApproxEq<Epsilon = <<P as Point>::Vector as Vector>::Scalar>,
<<P as Point>::Vector as Vector>::Scalar: BaseFloat,
{
/// Create the identity transform (causes no transformation).

View file

@ -79,6 +79,7 @@ pub struct Decomposed<V: Vector, R> {
}
impl<P: Point, R: Rotation<P>> Transform<P> for Decomposed<P::Vector, R> where
// FIXME: Ugly type signatures - blocked by rust-lang/rust#24092
<<P as Point>::Vector as Vector>::Scalar: BaseFloat,
{
#[inline]
@ -224,6 +225,7 @@ pub trait ToComponents2<S: BaseFloat, R: Rotation2<S>>: ToComponents<Point2<S>,
pub trait ToComponents3<S: BaseFloat, R: Rotation3<S>>: ToComponents<Point3<S>, R> {}
pub trait CompositeTransform<P: Point, R: Rotation<P>>: Transform<P> + ToComponents<P, R> where
// FIXME: Ugly type signatures - blocked by rust-lang/rust#24092
<<P as Point>::Vector as Vector>::Scalar: BaseFloat,
{}
@ -231,6 +233,7 @@ pub trait CompositeTransform2<S: BaseFloat, R: Rotation2<S>>: Transform2<S> + To
pub trait CompositeTransform3<S: BaseFloat, R: Rotation3<S>>: Transform3<S> + ToComponents3<S, R> {}
impl<P: Point, R: Rotation<P> + Clone> ToComponents<P, R> for Decomposed<P::Vector, R> where
// FIXME: Ugly type signatures - blocked by rust-lang/rust#24092
<<P as Point>::Vector as Vector>::Scalar: BaseFloat,
{
fn decompose(&self) -> (P::Vector, R, P::Vector) {

View file

@ -111,7 +111,9 @@ use num::{BaseNum, BaseFloat};
/// A trait that specifies a range of numeric operations for vectors. Not all
/// of these make sense from a linear algebra point of view, but are included
/// for pragmatic reasons.
pub trait Vector: Array1<Element = <Self as Vector>::Scalar> + Clone // where
pub trait Vector: Clone where
// FIXME: Ugly type signatures - blocked by rust-lang/rust#24092
Self: Array1<Element = <Self as Vector>::Scalar>,
// FIXME: blocked by rust-lang/rust#20671
//
// for<'a, 'b> &'a Self: Add<&'b Self, Output = Self>,
@ -627,6 +629,7 @@ impl<S: BaseNum> Vector4<S> {
/// Specifies geometric operations for vectors. This is only implemented for
/// 2-dimensional and 3-dimensional vectors.
pub trait EuclideanVector: Vector + Sized where
// FIXME: Ugly type signatures - blocked by rust-lang/rust#24092
<Self as Vector>::Scalar: BaseFloat,
Self: ApproxEq<Epsilon = <Self as Vector>::Scalar>,
{
@ -647,6 +650,7 @@ pub trait EuclideanVector: Vector + Sized where
/// The norm of the vector.
#[inline]
fn length(&self) -> Self::Scalar {
// Not sure why these annotations are needed
<<Self as Vector>::Scalar as ::rust_num::Float>::sqrt(self.dot(self))
}
@ -679,6 +683,7 @@ pub trait EuclideanVector: Vector + Sized where
/// Normalises the vector to a length of `1`.
#[inline]
fn normalize_self(&mut self) {
// Not sure why these annotations are needed
let rlen = <<Self as Vector>::Scalar as ::rust_num::Float>::recip(self.length());
self.mul_self_s(rlen);
}