micromath
micromath copied to clipboard
Add commutative multiplication on primitive scalar types for Vectors
This one partially addresses #105 and the implementation is somewhat debatable. In general, commutative operations (e.g. Mul<C> for Vector3d<C> and Mul<Vector3d<C>> for C) cannot be implemented due to trait implementation coherence rules.
Given that the crate exports some standard types such as F32x2, I16x3 etc. it is at least possible to define commutative math for these specific implementations, and this is what this PR does.
I did not add scalar Add here as it didn't exist before and is mathematically meaningless.