Transformation matrix from a translated-rotated coordinate system to the general coordinate system In Figure 1, suppose $XYZ$ (in black) as my general coordinate system and $X'Y'Z'$ (orange) as another system with parallel axes respect to $XYZ$. Consider $xyz$ (green) is my 3rd coordinate system with the following specifications:


*

*Its center point, $o$, has been located at $(X_0,Y_0,Z_0)$ with respect to my general coordinate system

*Each of its axis $x$, $y$ and $z$ has a known rotation respect to $X'Y'Z'$ axes (let say $\alpha$, $\beta$ and $\gamma$ respectively).


Consider I have a 3-d equation in $xyz$ (green). How can I obtain the equation of my object in $XYZ$ (black)?
In fact, I want to know matrix of coefficients that I can multiply by $(x,y,z)$ to convert it directly to $(X,Y,Z)$.

 A: A matrix operation expresses a linear transformation, and as such will always map the origin to the origin. For this reason, you cannot express the translated coordinate system in terms of a simple $3\times3$ matrix, much less the translated-and-rotated one.
One common approach to solve this problem is using homogeneous coordinates. The stripped-down version of this concept is this: add a fourth coordinate which will always be $1$. You need a more general setup if you want to express projective transformations, but you only have affine transformations, so this approach is enough.
Now you want a matrix product of the form
$$
\begin{pmatrix}X\\Y\\Z\\1\end{pmatrix}=
\begin{pmatrix}
M_{11}&M_{12}&M_{13}&M_{14}\\
M_{11}&M_{12}&M_{13}&M_{14}\\
M_{11}&M_{12}&M_{13}&M_{14}\\
0&0&0&1\end{pmatrix}\cdot
\begin{pmatrix}x\\y\\z\\1\end{pmatrix}
$$
As you can see, I assume column vectors, and products where the matrix is on the left and the vector is on the right. You can compute this matrix as a product of matrices. For example, a translation from the origin to the point $o$ would be written as
$$M_0=\begin{pmatrix}
1&0&0&X_0\\
0&1&0&Y_0\\
0&0&1&Z_0\\
0&0&0&1
\end{pmatrix}$$
Your description about the rotations is not very precise, but if you know what you want to do, you can likely formulate this into a product of rotation matrices as well. In the end, multiply all the operations you want to perform, in the correct order (i.e. first operation to perform is the rightmost matrix of the product), and you are done.
