cgmath icon indicating copy to clipboard operation
cgmath copied to clipboard

Remove Transform::{one, concat} methods from Rotation and Transform

Open brendanzab opened this issue 9 years ago • 2 comments

These should be inherited from One, with concat being the multiplication operator.

Edit: To clarify, both traits do not currently implement these operators.

brendanzab avatar May 11 '16 12:05 brendanzab

This has the added benefit of allowing us to implement the rotation traits on matrices.

brendanzab avatar May 11 '16 13:05 brendanzab

Looking at it now, this will require a trait impl of:

impl<P: EuclideanSpace, R: Rotation<P>> One for Decomposed<P::Diff, R>

This causes:

error: the type parameter `P` is not constrained by the impl trait, self type, or predicates [--explain E0207]
  --> src/transform.rs:60:6
60 |> impl<P: EuclideanSpace, R: Rotation<P>> One for Decomposed<P::Diff, R> {
   |>      ^

We'll need to finally bite the bullet and convert Rotation and Transform to use associated types if we want to do this. So:

trait Rotation: Sized + One {
    type Vector: InnerSpace;
    type Point: EuclideanSpace<Diff = Vector>;

    ...
}

trait Transform: Sized + One {
    type Vector: InnerSpace;
    type Point: EuclideanSpace<Diff = Vector>;

    ...
}

brendanzab avatar May 11 '16 13:05 brendanzab