# Can't figure out this transformation matrix

So basically I want to write a transformation matrix to take me out of one coordinate system and into another.

The transformation has to be as follows:

1) The positive z axis normalized as Vector(0,0,1) has to map to an arbitrary direction vector in the new coordinate system Vector(a,b,c)

2) The origin in the original coordinate system has to map to an arbitrary position P in the new coordinate system.

3) This might be redundant but the positive Y axis has to map to a specific direction vector(d,e,f) which is perpendicular to Vector(a,b,c) from before.

So my question is twofold: 1) How would I go about constructing this transformation matrix and 2) Is this enough data to ensure that any arbitrary vector in coordinate system 1 will be accurately transformed in coordinate system 2?

• Your point (1) is a little weird: so you just want $\,(0,0,1)\,$ mapped to some vector, uh? This is going to happen with any linear map, so I'm not sure what you actually meant. – DonAntonio Jun 1 '13 at 10:12
• A matrix represents a linear transformation so the origin will necessarily map into itself. – roger Jun 1 '13 at 10:16
• I don't mean any arbitrary vector I mean a specific arbitrary vector. As in, if the new vector is (1,0,0) then (0,0,1) should map to (1,0,0) and if the new vector is (0.5, 0.5, 0) then (0,0,1) should map to (0.5,0.5, 0). This is for a program I'm writing so the matrix would have variables that could update depending on what this vector is. And to roger, that's not true that the origin will map to itself. If you use homogeneous coordinates you can do a translation which will move even the origin. – user1855952 Jun 1 '13 at 10:19
• @user1855952, Roger's right: matrices act as linear transformations and thus they will always map zero to zero. What you want is an affine transformation, and reading the answer here below you can learn that it is not a matrix but a matrix followed by a translation. – DonAntonio Jun 1 '13 at 11:01
• If you use homogeneous coordinates you can make the change with just a single matrix. There exists a 4x4 translation matrix of the form {1, 0, 0, x}, {0, 1, 0, y}, {0, 0, 1,z}, {0,0,0,1} which is a single matrix working as an affine transformation. – user1855952 Jun 1 '13 at 12:44

$(1)$ Request $2$ says that we are working with affine transformations, because you are mapping $O$ to another arbitrary point of $\mathbb{R}^3$. But in order to be a valid affine transformation of the form $\overrightarrow{v}' = A\overrightarrow{v} + b$ (b is a translation), we must have that $\det A \neq 0$.
to define $A$, you have to figure out how it transform a basis of your space, in your case $\overrightarrow{e_1},\overrightarrow{e_2},\overrightarrow{e_3}$. (they are the normalized of axis x,y,z)
$(2)$ $A \overrightarrow{e_3}$ is fixed by request 1, the same for $\overrightarrow{e_2}$ , but you need to know something about the image of $e_1$. Just because even if you want that it,is,orthogonal to the other images of the elements of the basis you have 2 different options for $A \overrightarrow{e_1}$ (the 2 directions of a vector).
So you can't build an unique transformation with this informations. In other words if you define $A$ as your matrix, then you can define $A'$ with the property of $A' \overrightarrow{e_1} = -A\overrightarrow{e_1}$ and this will satisfy your requests. (to build $A'$ just switch the signs on the first column of $A$)