# 2D Coordinates of Projection of 3D Vector onto 2D Plane

• The plane $P$ is passing through the origin and has normal $n$.

• $u$ is a 3D vector and $u'$ its projection onto $P$: $u' = u - \langle u,n \rangle n$ (assuming $n$ has unit length).

• $e'_1$ and $e'_2$ are 2D vectors that span $P$

• Suppose that $e'_1$ and $e'_2$ are related to $e_1$ and $e_2$ by the same rotation as $n$ and $e_3$ (Maybe that's not very clear. What I want is: if I were to align $n$ and $e_3$, $e'_1$ and $e'_1$ should be aligned with $e_1$ and $e_2$ respectively).

My question is: How to find the 2D coordinates of $u'$ in $P$? That means, finding $e'_1$ and $e'_2$ and $a$ and $b$ such that $u'_{2D} = a*e'_1 + b*e'_2$.

My question is similar to this one but without the projection part.

Thanks!

-
just an idea, not really sure. won't a rotation matrix convert the coordinates of projections from one system to another? – Aseem Dua Nov 13 '12 at 20:09
Are $e_1'$ and $e_2'$ given, or do you need to find them? Your question seems to imply both… – MvG Nov 14 '12 at 0:00
@Aseem Yes, a rotation is certainly involved however there must be more to this since I need to go from 3D to 2D as well. – Tobold Nov 14 '12 at 4:00
@MvG I need to find them based on the restriction imposed on them (the "same" rotation that relates $n$ and $e_3$). Could you show me, however, what I would need to do in case the $e'$ were given? – Tobold Nov 14 '12 at 4:10
@Tobold So you have $n=Re_3$, $e_1'=Re_1$ and $e_2'=Re_2$ for some suitable rotation matrix $R$? What exactly are you given, $n$, $P$...? – Daryl Nov 14 '12 at 7:07

Your goal should be finding a suitable $2\times3$ matrix which you multiply with your 3D vector to obtain the projected 2D vector.

I assume that $e_1, e_2, e_3$ are both unit length and orthogonal to one another, i.e. that you're dealing with an orthogonal coordinate system in 3D. All 3D vectors are assumed to be expressed in this coordinate system. Without orthogonality, you'd have trouble matchiung the relation of $e_1', e_2', n$ to that of $e_1,e_2,e_3$, as $n$ is orthogonal to $e_1',e_2'$.

You first need to find a vector $e_1'$ which should be unit length, lie in the plane, but may be rotated about the origin in an arbitrary way. One way to achieve this is by choosing an arbitrary vector $v$, and computing the cross product between $v\times n$. The resulting vector will always be orthogonal to $n$. If you are unlucky, $v$ might be parallel to $n$, in which case the cross product has length zero. So in the possible presence of numerical complications (i.e. rounding errors, so you won't get an exact zero), it might be easiest to try $e_1,e_2,e_3$ as $v$, and choose the result with maximal length. Then normalize its length to 1, and you have a suitable $e_1'$.

Next, you compute $e_2'$ as the cross product of $e_1'$ and $n$. Depending on the way $e_1,e_2,e_3$ relate to one another, you'll have to do this either in one or in the other order to end up with the correct sign for $e_1$. Simply try them out. The length of the result should already be unit length, at least if $n$ had unit length and $e_1'$ was chosen as described above.

Now that you have $e_1'$ and $e_2'$, you can simply use these as the rows of your desired projection matrix. The rationale here is as follows: the matrix times vector multiplication will compute two scalar products, which correspond to the portion of your input vector which lies in the direction of that vector, i.e. the length of the orthogonal projection along one direction. Take two of these, and you have coordinates in a coordinate system within the plane, obtained from orthogonal projection onto that plane.

-
Thank you very much, this sounds reasonable and is explained very well. Your assumptions about the coordinate systems w.r.t. orthogonality are correct. One further question: "Depending on the way $e_1$,$e_2$,$e_3$ relate to one another, you'll have to do this either in one or in the other order to end up with the correct sign for $e_1$. Simply try them out." What relation of $e_1$,$e_2$ and $e_3$ do you mean here and how can I check which sign is the correct one for $e'_2$? I need to do this for many different $n$ and want to avoid that e.g. $e'_1$'s direction suddenly flips. – Tobold Nov 14 '12 at 8:00
Your coordinate systems is either right hand or left hand. See en.wikipedia.org/wiki/…. You can check whether the handedness agrees by comparing the determinants. For unit vectors $e_1,e_2,e_3$ the determinant will be $1$. For $e_1',e_2',z$ it will be $1$ if you have the correct order, but $-1$ if you got it wrong. Once you have the correct order, it will be correct for all inputs. – MvG Nov 14 '12 at 10:11
Is it possible to extend it to cases where plane P does not pass through the origin ? Thanks ! – CTZStef Aug 5 '13 at 14:49
@CTZStef: You can choose some point on $P$ and subtract it from all other points, effectively shifting that point to the origin. If needed, you can do the reverse afterwards, adding the same vector. – MvG Aug 5 '13 at 15:06