by hmmmm · 17y ago · 0 comments
So instead of view = projection * model; you would prefer.
view.SetVector(Multiply3x3matrixWith3x1Vector(projection.GetMatrix(),model.GetVector());
Should we allow floats an doubles to be multiplied with a'*' or should that use properly named classes
How does someone looking at the code know which parts of projection and model get multiplied here ?
At least make it:
view.setVector(projection.getMatrix() * model.getVector());
Because '*' applied to a model or a projection could literally mean anything, there might be many elements in those structures that are candidates for multiplication.By making it explicit what gets multiplied the code is less clear than it could be.
If they're simple arrays without further fields attached to them then you could do:
view = matvecmul(projection,model);
And that's pretty close to the overloaded example.Multiplying matrices is no more weird than multiplying a float by an int or a positive and negative number.