# How to change of basis from 3 points

I'm a computer scientist and I'm not very good with mathematical stuff...

I have got 3 points A, B, C that doesn't create an orthogonal space. I have the coordinates of those 3 points in two 3D orthogonal spaces: M (the global space) and T (the local space). In Pic.1, we can see the coordinates of the 3 points in M space. The point Ot is the center of the circumcircle of the triangle ABC. That point Ot is also the origin of the T space but we don't know the coordinates in M space.

In Pic.2, we can see the coordinates of the 3 points in T space.

In this example, I know there is just a translation to pass to one space to another but I don't know how to calculate it.

I saw on the Internet that to change basis, you need to have a matrix that "link" the two spaces:

$M = P.T$ where P is this "link" matrix.

I can understand that formula but I don't know how to calculate P or even M and T... Do I need to defined 3 vectors that defined the space? How can I do that from 3 random points?

Thanks!

PS: sorry for my english...

EDIT

Now that I understand my problem better, I'm going to reformulate it.

I have three arbitrary points $A$, $B$ and $C$ in two systems that represents a local system $T$ and a world system $M$.

You can see an example in Pic.3 and Pic.4, $A$, $B$ and $C$ are defined in both systems but the origin $O_T$ of the local system is just defined in the local system and I have no possibility to get it.

The pictures that I show you are just an example but in most cases, we're practically always going to have a rotation and a translation.

We also know that the transformations are always perform to the whole local system and the world system is fixed.

In this example, the transformations between the local system and the world system are a rotation (along the Z-axis with an angle of $-\pi/2$) and a translation (with the vector $(-4, 0, 0)$). In real case, I do not know the transformation applied to the local system.

My problem is to calculate the transition matrix between the local system and the world system.

Thanks again!

If I well understand you want transform the coordinates of $A,B,C$ from the system $M$ to the system $T$ centered on the center of the circle passing through $A,B,C$. We can do this by the steps:

1) find the center $O'$ of the circle. Since $A,B,C$ are all point on the plane $z=0$ this can be solved as problem of plane geometry. We can use the equation $x^2+y^2+ax+by+c=0$ of a circle and find $a,b,c$ solving the system obtained when we substitute the coordinates of the given points. Than we find the coordinates of $O'=(\alpha,\beta,0)$ as $\alpha=-a/2$ and $\beta=-b/2$.

2) The transformation from the coordinates of a point in the system $M$ to a system with parallel axis centered in $O'$ is given by: $(x,y,z)\rightarrow (x',y',z')=(x-\alpha,y-\beta,z)$ and this can be applied to the points $A,B,C$.

But, performing these calculations starting from the coordinates $(x_M,y_M,z_M)$ in your 'Pic1' , I don't find your coordinates $(x_T,y_T,z_T)$ in 'Pic2' (if I have not some mistake). So I suppose that there is some other linear transformation from $(x',y',z')$ to $(x_T,y_T,z_T)$. In such a case you need another step to find this linear transformation. If the axis in $M$ and $T$ are parallel, as it seems from the pictures, this transformation reduce to a scaling factor (eventually different on the three axis) but, calculating, this not seems the case, so the problem is a bit more complicated.

3) You can find this transformation $M$ solving for $a_{i,j}$ the system: $$\begin{bmatrix} a_{1,1}&a_{1,2}&a_{1,3}\\ a_{2,1}&a_{2,2}&a_{2,3}\\ a_{3,1}&a_{3,2}&a_{3,3} \end{bmatrix} \begin{bmatrix} x_T\\ y_T\\ z_T \end{bmatrix} = \begin{bmatrix} x'\\ y'\\ z' \end{bmatrix}$$
for the three points $A,B,C$

Finally, you can represents the translation and the linear transformation with a single matrix using homogeneous coordinates. (you can see here for an example)

It seems from the figures that the center of the circle is a point on the plane $z=0$ so if its coordinates are $O=(\alpha,\beta,0)$ the translation from the origin of the global coordinate to the local corrdinates is $(0,0,0)\rightarrow (\alpha,\beta,0)$

Tis translation can be represented in homogeneous coordinate by a $4\times 4$ matrix. This representation depend on the convection that you use for the representation of homogeneous coordinates. If you represent a point as a column vector $$\begin{bmatrix} x\\ y\\ z\\ 1 \end{bmatrix}$$ than the translation of the origin is represented by the matrix $$\begin{bmatrix} 1&0&0&-\alpha\\ 0&1&0&-\beta\\ 0&0&1&0\\ 0&0&0&1\\ \end{bmatrix}$$ that operate on the left of the column vectors, such that the center of he circle become the new orgin: $$\begin{bmatrix} 1&0&0&-\alpha\\ 0&1&0&-\beta\\ 0&0&1&0\\ 0&0&0&1\\ \end{bmatrix} \begin{bmatrix} \alpha\\ \beta\\ 0\\ 1 \end{bmatrix}= \begin{bmatrix} \alpha-\alpha\\ \beta-\beta\\ 0\\ 1 \end{bmatrix}= \begin{bmatrix} 0\\ 0\\ 0\\ 1 \end{bmatrix}$$

You have an equivalent representation interchanging columns-rows, but in this case you have to multiply the matrix at the right: $$\begin{bmatrix} \alpha&\beta&0&1 \end{bmatrix} \begin{bmatrix} 1&0&0&0\\ 0&1&0&0\\ 0&0&1&0\\ -\alpha&-\beta&0&1\\ \end{bmatrix}= \begin{bmatrix} 0&0&0&1 \end{bmatrix}$$

• Thank you for your answer. I forgot to explain the purpose of my problem: I need to find the coordinates of the system T in the system M but the only data I have is just those 3 points in the two systems. I also know that there is no scaling transformation but we can have some translation or rotation of the system T. – Athius Jul 2 '15 at 15:37
• I think that you have to better define the problem. The steps that I indicate only works, but the calculations can be more or less laborious. If the transformation is a translation plus a rotations, you can reduce the number of the $a_{i,j}$ that whe have to find. And it is also important to know if the coordinates in your $pc2$ are exact values or approximated values. – Emilio Novati Jul 2 '15 at 20:55
• Thank you for your time. I just add a new information... I can't suppose that the center of the circumcircle of the triangle ABC is the origin of the system. I'm very confused and don't know how to resolve $\left[ \begin{matrix} x' \\ y' \\ z'\\ 1 \end{matrix} \right] = \left[ \begin{matrix} a_{1,1} & a_{1,2} & a_{1,3} & 0 \\ a_{2,1} & a_{2,2} & a_{2,3} & 0 \\ a_{3,1} & a_{3,2} & a_{3,3} & 0 \\ a_{4,1} & a_{4,2} & a_{4,3} & 1 \end{matrix} \right] \left[ \begin{matrix} x \\ y \\ z \\ 1 \end{matrix} \right]$ I always obtain a translation of 0 for all axis. – Athius Jul 15 '15 at 13:31
• If you represents the homogeneous coordinates as column vectors (with the 4-coordinate $=1$), than the translation is represented by the elements in the last column of the matrix, and the last row is $(0,0,0,1)$. The representation in your comment works if the homogeneous coordinates are represented by row and the action of a transformation is represented as a product of the row vector to the left of the matrix. – Emilio Novati Jul 15 '15 at 14:38
• Maybe that you was confused by the example cited in my answer, where is used the representation by rows. But note that in this example the multiplication is performed with the row vector to the left of the matrix. – Emilio Novati Jul 15 '15 at 14:49