1. ## Co-ordinate Reflection/Rotation Problem

Hello everyone, I'm fairly new to maths and have only recently been interested many years after my education so I'm attempting to teach myself fundamentals and things I find interesting. As of that I apologise if this problem is terribly worded

So I have 2 quads, ABCD and A'B'C'D', I know a point P inside ABCD and I want to find a point P' inside A'B'C'D' based on the relationship between the two quads?

For example in this diagram...

I can see from looking that the difference between the 2 based on the order of the verts is a reflection as shown by the blue line, I can then work out P'. However given a different ordering of the second quads verts is there some way to work out what the process is to convert P to P'?
Basically looking for an algorithm that can know what you have to do to P to get P' using only the co-ordinates of the 2 quads.
I hope this makes some sense, having a hard time explaining what I'm trying to do in maths terminology

Many thanks in advance to anyone that can point me in the appropriate direction

2. ## Re: Co-ordinate Reflection/Rotation Problem

This problem can be easily solved using linear algebra. At first let's assume that A coincides with A'. We may consider two coordinate systems with origin A: one has base vectors AB and AC, the other AB' and AC'. Now, let a point P have coordinates (x, y) in the first system (ABC) and P' have the same coordinates (x, y), but in the second system (AB'C'). Then the coordinates of P' in the first system can be found as the result of multiplication of the transformation matrix A and the column vector $\displaystyle \begin{pmatrix}x\\ y\end{pmatrix}$. The matrix A of the transformation T that converts the first coordinate system into the second one is obtained by "transforming each of the vectors of the standard [i.e., first] basis by T and then inserting the results into the columns of a matrix. In other words,

$\displaystyle \mathbf{A} = \begin{bmatrix} T( \vec e_1 ) & T( \vec e_2 ) & \cdots & T( \vec e_n ) \end{bmatrix}$ "

(Wikipedia).

Let's assume that the square length is 1 in your example. Then (still assuming that A coincides with A'), vector A'B' has coordinates $\displaystyle \begin{pmatrix}0\\ -1\end{pmatrix}$ in the first system, and vector A'C' has coordinates $\displaystyle \begin{pmatrix}-1\\ 0\end{pmatrix}$. Therefore, the transformation matrix is

$\displaystyle A=\begin{pmatrix}0 & -1\\ -1 & 0\end{pmatrix}$

Let P has coordinates, say, $\displaystyle \begin{pmatrix}0.7\\ 0.8\end{pmatrix}$ in the first system. Then P' has coordinates

$\displaystyle \begin{pmatrix}0 & -1\\ -1 & 0\end{pmatrix}\begin{pmatrix}0.7\\ 0.8\end{pmatrix}=\begin{pmatrix}0\cdot 0.7-1\cdot0.8\\-1\cdot0.7+0\cdot0.8\cdot\end{pmatrix}=$$\displaystyle \begin{pmatrix}-0.8\\-0.7\end{pmatrix}$

still in the first system.

If A does not coincide with A', then after the first transformation it is sufficient to have a shift by the vector AA', i.e., add the coordinates of A' in the first system (where A is the origin) to the result of matrix multiplication.

You can get a better idea if you read a good textbook on linear algebra describing linear transformations.

3. ## Re: Co-ordinate Reflection/Rotation Problem

Wow thanks for the information. It seems I need to go do some reading as I wasn't entirely confident I understood it all. Appreciate your help, you've given me plenty of leads!