I agree. Pinter's book is very easy to read and great for self-study.
HN user
codeofthedamned
I believe we are mincing words with the added confusion of two mathematical meanings for the word vertex in this discussion.
The single row matrix, called a vertex, and a Euclidean vertex which we use to represent the points in the geometry, and happen to store in a vertex (matrix).
I do agree with your statement.
Translation itself is not a linear transformation. To simply translate a vertex is a matrix addition(subtraction) problem.
The only reason that it is possible in the transformation matrix is because of the addition of the fourth parameter in a vertex [x y z 1] to create a homogenous linear system. This allows the translation to become a part of the transformation matrix.
I have corrected the code by removing the reference.
The way the code is now structured will allow for the RVO (Return-value optimization) to occur, so the new instance will be constructed in the location of the receiving object.
Move semantics would not apply in this case, it would actually suffer from a similar problem as the version that returned a reference, except the program would not crash. Instead the return value would contain garbage.
(edit: added a link to details on how to use move semantics) http://codeofthedamned.com/index.php/c-r-value-references
I did not use expression templates, or try to optimize any of the implementation because my intent is to demonstrate "how" to get started with the math. I also wanted to make the code accessible to programmers that do not use C++. For example, someone trying to learn WebGL.
Thanks for pointing out my mistake, I have corrected the code to simply return from the stack.
That's a helpful site, especially the interactive examples. Thanks for the link
My intention with this first post was to show how to work with the mathematical constructs.
I have already started on the next article, which will provide the context for what these mathematical constructs provide.
To briefly answer your question, for 3d graphics the Matrix provides an efficient mechanism to translate, scale, rotate, shear and convert between different coordinate systems.