Re:Introduction to the Math of Computer Graphics
by pandaman on Wednesday December 30, 2015 @01:35PM
(#10813473)
Matrix multiplication by vector and vice versa is a multiplication by at least one non-square matrix. But matrix addition, on the other hand, is something I have never seen come up in graphics.
Re:Introduction to the Math of Computer Graphics
by codeofthedamned on Wednesday December 30, 2015 @11:49PM
(#10816202)
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.
Re:Introduction to the Math of Computer Graphics
by pandaman on Thursday December 31, 2015 @01:56AM
(#10816587)
I am not sure what you mean. If by "matrix addition" you meant adding vectors then it's obvious but adding actual matrices won't give you any translation operators because no matter how many matrices you have added together you still end up with a matrix, which, indeed, can only represent linear operators.
Re:Introduction to the Math of Computer Graphics
by codeofthedamned on Thursday December 31, 2015 @03:02AM
(#10816756)
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.
[deleted]
Re:Introduction to the Math of Computer Graphics
by pandaman on Wednesday December 30, 2015 @01:47PM
(#10813547)
I was never a fan of special cases in Math. Especially when it's not a special case. Saying that an element in the product matrix is a product of a row taken from one matrix and a column from another does not require matrices to be square and fits all possible applications of matrix multiplication already.
From the title, I was hoping this would cover coordinate systems, the Bresenham line algorithm and midpoint circle algorithm, Lambertian reflection, perspective transformation, quaternions, Gouraud and Phong shading, rotation, metaball approximation, parametric vs. implicit vs. explicit function representation, splines, ray tracing, alpha compositing, and some basic filtering. Instead, it consists only of basic linear algebra — it doesn't even cover how to generate a rotation matrix! However, it does cover a lot of stuff that basically doesn't come up at all in computer graphics, like multiplying nonsquare matrices together, and as pandaman points out, adding matrices together.
(Also, as overgard points out, the code contains basic novice errors: https://news.ycombinator.com/item?id=10812881)
(pandaman correctly points out that matrix-vector multiply is a special case of multiplying nonsquare matrices. I still don't think you need to deal with that in an introduction; it's easy to learn as a special case, and that's probably how you'll have to code it anyway!)
Unfortunately, I don't know where to point people for a real introduction to the math of computer graphics. This is a shame; even without libraries and hardware, you can do rotating 3-D shapes in just 15 lines of code http://canonical.org/~kragen/sw/netbook-misc-devel/rotcube.p... or ray-tracing in 186: http://canonical.org/~kragen/sw/aspmisc/my-very-first-raytra... or basic VR with your cellphone accelerometer in 114: http://canonical.org/~kragen/sw/81hacks/topopt-ar/
(That last one is cheating a little bit since I didn't write the circle-drawing algorithm myself, so it isn't included in the line count.)
Math is super powerful when you apply it to computer graphics. It empowers you to make magic happen in only a few hours and a few dozen lines of code, and the magic is visible even to people who can't program. You don't have to understand all that math stuff I mentioned in the first paragraph in order to do these things.