fu5ha/ultraviolet

multiply_left/multiply_right methods for matrices and rotors

thenlevy opened this issue · 3 comments

What do you think about adding multiply methods for matrices and rotors? I'm thinking about methods of the form

pub fn multiply_left(&mut self, lhs: Self) {
  *self = lhs * *self;
}
pub fn multiply_right(&mut self, rhs: Self) {
  *self = *self * rhs;
}

The multiply right is probably the most usefull since I believe these types already have an *= implementation

fu5ha commented

In my case, I'm manipulating cylinders that can be rotated/translated. Initially their axis is aligned with the x axis and I'm changing the direction of their axis by left multiplying their model matrix by a rotation in the xz or yz plane.

The cylinders can also rotate around their axis which is achieved by right multiplying the model matrix by a rotation in the yz plane.

Anyway all this can easily be done without the methods that I want to add, so I would understand if you don't want to overload the library

fu5ha commented

Hmmm yeah I'm inclined to say that I don't really see a compelling reason that these methods make that significantly easier than just typing mat * other_mat vs other_mat * mat