dche / glm-rs

GLSL mathematics for Rust programming language.
MIT License
42 stars 21 forks source link

Transforms mix borrows and moves #20

Closed adam-r-kowalski closed 7 years ago

adam-r-kowalski commented 7 years ago

Hey is there a reason why for the various transformation functions like translate, rotate, etc, you borrow the matrix and move the vector? I'm not sure I understand why the transform needs to take ownership of the vector.

Nercury commented 7 years ago

Hey, I remember adding the first transform and there was no particular reason for that choice.

dche commented 7 years ago

Hi. Vectors have the Copy trait. So there is no move when calling these functions. I normally treat vectors as primitive types like integers and floating point numbers. That's maybe the reason of the design. You can see that we use copy semantics even in functions as basic as arithmetic operators (e.g., Add, Mul) of vectors.