# Convert a 'world' point to a 'local' point relative to a plane

I'm trying to find a way of converting a point relative to the world into a point relative to an arbitrary plane (and a way to convert back). This will be coded into C++ so I'll have to able to write functions for your answers $:)$

In 3d-space, my plane defined by $ax + by + cz + d = 0$, where $(a,b,c)$ is a normalised vector, and my world point is $P(x_p,\ y_p,\ z_p)$. I'd like to find a way to convert the 'world point' from the World plane which has centre $(0, 0, 0)$ and normal $(0, 1, 0)$, into a 'local point' relative to my plane having centre $(x_c,\ y_c,\ z_c)$ and normal $(a, b, c)$.

I attempted to discern this function myself, and I came up with calculating the distance from the origin to the world point and the direction from origin to world point. From that, I could then position the point that distance away along the line formed by combining the plane normal and the line direction. Unfortunately, that's where I got stuck as I couldn't work out a suitable operation.

(NB: my mathematics level is probably rather rudimentary compared to the average on here - while I have a relatively firm grasp on vectors I don't have much experience or confidence with matrices, which I unfortunately suspect may be involved in the answer)

Edit: Having read through your comments and answers and thinking about what I mean I've come to the conclusion that I'm not even sure of the question myself. There's at least two different interpretations I've confused myself with in the last 10 minutes... I think perhaps the best way forward is for me to completely rethink what I'm trying to do and not post questions late into the night. Thank you for your help, anyway :)

-
There are some points in your question that are still not clear. First of all, I want to make sure that your world point belongs to the world plane. Second, what you want to do is project that 3D point into the second plane, that does not contain the world point, right? If that is so, then there is not a unique way to do it. You have to define a projection mapping. You could project the point perpendicularly into the plane, for example, but that is not the only way to do it. – Manolito Pérez Feb 11 '12 at 15:03
Your question doesn't quite make sense. One usually speaks of converting points between reference frames or coordinate systems, and a plane is not a coordinate system. You need two more vectors that lie along the plane, say $u$ and $v$, before you can meaningfully talk about converting a point from the world coordinate system, relative to the $x$, $y$, and $z$ axes, to the local coordinate system, relative to $u$, $v$, and $n$. – Rahul Feb 11 '12 at 15:11
I just saw Manolito's comment that has a very different interpretation of your question than mine. Maybe you should post an example of what you are trying to achieve with this procedure, so that there is no confusion. – Rahul Feb 11 '12 at 15:15
Is this computer graphics? You can let $(0,0,0)$ be the eye of observer and $z=1$ be the screen. For any point $(x,y,z)$, the line $l$ connecting $(0,0,0)$ and $(x,y,z)$ will intersect the $z=1$ plane at some point $(a,b,1)$. Is that what you want? – FiniteA Apr 12 '12 at 12:50

I conjecture you have points ${\bf x}=(x,y,z)$ in $3$-space and you are given their orthogonal projection ${\bf x}':=P_y({\bf x})=(x,z)$ onto the "world plane" $y=0$. If you just have ${\bf x}'$, the $y$-coordinate of your point ${\bf x}$ is lost, and there is no way to get it back: All points ${\bf x}=(x_0,y,z_0)$, $-\infty<y<\infty$, project onto the same point ${\bf x}'=(x_0,z_0)$.
Now you are considering in addition a fixed plane $\pi\colon\ ax+ by+cz +d =0$, and you are envisaging a certain projection $P\colon \ {\mathbb R}^3\to\pi$ of $3$-space onto this plane $\pi$ (you have not specified this projection; maybe it is assumed to be orthogonal, maybe it is a "perspective"). As soon as you specify geometrically what you have in mind it will be possible to produce formulas of the form $$P\colon \ (x,y,z)\mapsto (x',y',z')^T:=A{\bf x} + {\bf b}\ ,$$ where $A$ is a certain matrix operating on the column vector ${\bf x}=(x,y,z)^T$, and ${\bf b}$ is a constant vector. If your projection is not a parallel projection but a "perspective" the corresponding formulas will be more complicated.
For the reasons mentioned above it is not possible to obtain $P({\bf x})$, given ${\bf x}'$. It is true that by applying $P$ also some information about ${\bf x}$ is lost, but it is different from the information lost in applying the orthogonal projection $P_y$ onto the "world plane" $y=0$.