I have been trawling through this forum but am struggling to understand the maths a bit. Currently I have a 2D plane within a 3D space and I have the coordinates for them. I want to work on this 2D plane as if it is 2D since it is easier.
From what I've read, I want to create a rotation matrix which would make z constant so it can be effectively ignored. After carrying out my 2D calculations, I could then use the inverse of the matrix and bring it back into 3D space?
My problem is with the rotation matrix, is it a combination of rotating around the X-axis and Y-axis? Apologies for my maths ignorance! It would be great if someone could explain the steps/ point me in the right direction.
Many Thanks,
Kelvin.
EDIT: Here's an example of the KML data. This shows one triangle:
Triangle A
-1.465435652058573, 53.37698311217353, 68.20299999999998
-1.465442809960414, 53.37700937634325, 69.52299999999991
-1.465399364873617, 53.37701518696172, 68.20299999999998
-1.465435652058573, 53.37698311217353, 68.20299999999998
(The reason why it has 4 points is because the first and last are repeated to indicate a closed polygon. Sorry if it is confusing!)
EDIT 2:
Simon's answer to my question seems to make sense! If anyone has problem with the Gram-Schmidt process, have a look at this Youtube video. It was very useful for me! http://www.youtube.com/watch?v=ZRRG386v6DI
First of all I still don't fully understand the data you have given. Are those the $x,y$ and $z$ coordinates of four points? Why do four points form a triangle?
Secondly, if I interpret your data correctly the different points have very similar values. That might lead to numerical complications, i.e. the differences you investigate might be of the same order as the inaccuracy of your computer. So apart from theoretical issues one has to be careful with the implementation.
Leaving that aside you can describe the plane inside the three dimensional space by two vectors. Let us call them $v_1$ and $v_2$. Every point in the plane is then a linear combination of those two (that is if the origin is a point in your plane, but otherwise you may just change the origin which is a linear translation and well behaved). You can find $v_1$ and $v_2$ by just choosing any two linearly independent vectors in your plane. You may then choose a third vector $v_3$ which is not in you plane and the three vectors together span your whole three dimensional space. What you want to do next is transforming the vectors into a so called orthonormal basis. This orthonormal basis may be understood as a sort of a new coordinate system, where the given plane is just the $x$-$y$-plane. You can find this orthonormal basis purely mechanical by applying the Gram-Schmidt process to your vectors $v_i$.
Now the rotation you are looking for is just a rotation of this coordinate system. It is very easy to write down its inverse. Indeed the inverse is just the matrix with the three orthonormal vectors as columns. Since you need the transformation in both directions this is no extra effort.
It turns out that the matrix you obtain this way is a rotation (+possibly a reflection) but you don't have to find the angles and stuff.
So as a recepy:
Edit: Some important facts I still can't believe I forgot in the first go: