# How do I derive this transformation

If I had two right handed frames where one has vectors [i, j, k] and another with corresponding vectors [u v w], how would I derive the transform M[i j k] <-- [u v w] when applied to any point P in [u v w] we get its representation in [i j k] ?

They noted that for every unit we move in the [i j k] frame we move 2 units in the [u v w] frame and the origin of the [u v w] frame can be represented as [4i 6j 2k]

Can someone help me derive this? I'm fairly new to computer graphics and need some help in detail.

I'm not going to dive into much details about affine transformations and such, you are better off reading up on these concepts from good graphics books.

I think The matrix you need is this.

$$\begin{bmatrix} 0.5 & 0 & 0 & 4\\ 0 & 0.5 & 0 & 6\\ 0 & 0 & 0.5 & 2\\ 0 & 0 & 0 & 1\\ \end{bmatrix}$$

The reason why we need 4x4 matrices is because of affine transformations. For more details on why we have 4x4 matrices and why are we using 4D representation you can check my answer here. Briefly speaking, Vectors representing direction have an extra 0 at the end since translations don't affect these sort of vectors and Vectors representing points have an extra 1 at the end. This makes our vectors 4D so we can apply 4x4 transformation matrices. Since here we are concerned with points we will append an extra 1 to each vectors.

Let's begin by how did I derive it. First of all we can see that they provided the origin of the $$UVW$$ frame in terms of $$IJK$$ frame. This is $$[4i, 6j, 2k]$$. In other words the vector $$[0,0,0]$$ in $$UVW$$ frame must correspond to $$[4i, 6j, 2k]$$ in $$IJK$$ frame. Let's forget the 0.5's in the diagonal for now. We have,

$$\begin{bmatrix} 0 & 0 & 0 & 4\\ 0 & 0 & 0 & 6\\ 0 & 0 & 0 & 2\\ 0 & 0 & 0 & 1\\ \end{bmatrix} * \begin{bmatrix} 0\\ 0\\ 0\\ 1\\ \end{bmatrix} = \begin{bmatrix} 4\\ 6\\ 2\\ 1\\ \end{bmatrix}$$

Next the condition is if we move 1 unit in $$IJK$$ we move 2 units in $$UVW$$ or in other words if we move 1 unit in $$UVW$$ we move 0.5 units in $$IJK$$. This means if we move from origin to $$[1,1,1]$$ in $$UVW$$ we moved half a unit in the $$IJK$$ frame in each of the axis. Testing the original matrix now we have,

$$\begin{bmatrix} 0.5 & 0 & 0 & 4\\ 0 & 0.5 & 0 & 6\\ 0 & 0 & 0.5 & 2\\ 0 & 0 & 0 & 1\\ \end{bmatrix} * \begin{bmatrix} 1\\ 1\\ 1\\ 1\\ \end{bmatrix} = \begin{bmatrix} 4.5\\ 6.5\\ 2.5\\ 1\\ \end{bmatrix}$$

When constructing matrices this way, you want the translation factor in the last column. This factor is given to you by telling you the origin of the $$UVW$$ frame in terms of $$IJK$$ frame. This means the $$UVW$$ frame is that much displaced/translated when viewed from $$IJK$$ frame.

Secondly any scaling factor goes along the diagonal like above. This factor was given to you by telling you "If you move $$X$$ units in 1 frame, you move $$Y$$ units in the other". Which is what we want I guess. Is that what you need?