5 ms·
>done just as nice with a properly named function call. So instead of view = projection * model; you would prefer. view.SetVector(Multiply3x3matrixWith3x1Ve
by hmmmm 17y ago
>done just as nice with a properly named function call.
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
- jacquesm 17y agoActually, you sort of prove my point there. 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.
- uk12345 17y agoThe point is that there are fixed rules in Maths for what happens when you multiply 3x3 matrix by a 3x1 matrix and if this is even possible. Those should be enforced by the person writing the library's overloaded features not be left to the programmer to know which is the appropriate function to call. Multiplying matrices is no more weird than multiplying a float by an int or a positive and negative number.