     POV-Ray : Newsgroups : povray.binaries.misc : transformation matrix : Re: transformation matrix Server Time18 Jun 2021 01:37:35 EDT (-0400) Re: transformation matrix   From: clipka Date: 25 Dec 2018 22:46:59 Message: <5c22f9b3\$1@news.povray.org>    ```Am 25.12.2018 um 18:18 schrieb jr:
> hi,
>
> the documentation for the transformation matrix says: "... you will not use the
> matrix keyword because it is ... harder to visualize."  however, although
> "mathematically challenged", I'd like to learn to use it on occasion.
>
> that in mind, can someone please explain why the manual (3.3.1.12.4) mentions a
> "..fourth column implicitly set to <0,0,0,1>..", but the subsequent equations do
> not include/use those values.

The underlying mathematical operation of the matrix transform is a
multiplication of a vector (representing an original location) by a
matrix (the transformation matrix), yielding another vector
(representing the transformed location).

Now the simplest such operation would be a 3-component vector multiplied
by a 3x3-component matrix to yield a 3-component vector. However, such
an operation could only represent a true linear transformation - meaning
there could not be a translation component; the origin (<0,0,0>) would
always be mapped to itself.

Transformations can be "bolted on" to this concept (leading to what is
called "affine transformations") by complementing the matrix with a
3-component vector that is added after the matrix multiplication.

The resulting data structure can be considered a 4x3 matrix, with the
last row[*] having special semantics: While the other rows are
multiplied with the respective coefficient of the original vector, this
last row is added "as is", without any multiplication.

Alternatively, we can pretend that the 4th row is multiplied by 1 before
adding. We can also pretend that this factor of 1 is a 4th component of
the original vector.

It turns out that this idea can be taken even one step further, by using
4-component vectors all throughout (with the 4th component being fixed
to 1), and a 4x4-component matrix. To make this work, the last column[*]
of such a matrix must also be fixed, and have the coefficients {0,0,0,1}.

(It should be noted that this is just a fancy way of looking at the very
same algorithm, some magic sleight of hand to soothe people with OCD.)

[*There is disagreement between mathematicians and computer graphics
people about how to write matrices; where one faction uses columns and
rows, the other instead uses rows and columns, respectively.]
```    