I was looking at this post ($3D$ projection onto a plane) in which the answer describes how to project a given set of points onto any arbitrary plane. However, this transformation is still of the form $\mathbb{R}^3 \to \mathbb{R}^3$ and I would like to obtain a transformation of the form $\mathbb{R}^3 \to \mathbb{R}^2$. Essentially, I would like to have a 2-D graph of the points in my plane. How can I do this?
Projection onto a plane
5.4k Views Asked by Bumbble Comm https://math.techqa.club/user/bumbble-comm/detail AtThere are 3 best solutions below
On
The equation of a line in 3d is
$$ \frac{x-x0}{a} = \frac{y-y0}{b} = \frac{z-z0}{c} = k $$ where d1, d2 and d3 are the directional components of the plane.
Let x0, y0 and z0 be the points on the 3d plane.
And any point on the line would be $ka+x0$, $kb+y0$ and $kc+z0$
Now the equation of a plane is $$ ax + by + cz = d $$
Substituting for k in this equation you can solve for k.
This k when used in the equation of the line would give you the point where the line meets the plane.
That point would be the projection of the point in 3d onto 2d.
On
Suppose that the plane is the column space of a given matrix $\mathrm A \in \mathbb R^{3 \times 2}$
$$\{ \mathrm A \mathrm x \mid \mathrm x \in \mathbb R^2 \} \subset \mathbb R^3$$
Given $\mathrm y \in \mathbb R^3$, we have a linear system $\mathrm A \mathrm x = \mathrm y$. In general, $\mathrm y$ is not in the column space of $\mathrm A$. Hence, we project $\mathrm y$ onto the column space of $\mathrm A$. We first left-multiply both sides by $\mathrm A^T$, which produces $\mathrm A^T \mathrm A \mathrm x = \mathrm A^T \mathrm y$ (which always has a solution). As $\mathrm A$ has full column rank (otherwise its column space would be a line, not a plane), then $\mathrm A^T \mathrm A$ is invertible. Hence,
$$\hat{\mathrm x} := (\mathrm A^T \mathrm A)^{-1 } \mathrm A^T \mathrm y$$
gives us the coordinates of the projection of $\mathrm y$ onto the plane, using the basis formed by the two linearly independent columns of $\mathrm A$. Thus, the projection is
$$\mathrm y \mapsto (\mathrm A^T \mathrm A)^{-1 } \mathrm A^T \mathrm y$$
If the columns of $\mathrm A$ are orthonormal, then $\mathrm A^T \mathrm A = \mathrm I_2$ and the projection is simply $\mathrm y \mapsto \mathrm A^T \mathrm y$.
If your points are $P_k(x_k,y_k,z_k)$ belonging to a plane orthogonal to normal vector $N(u,v,w)$, take two mutually orthogonal vectors. For example (unless $u$ and $v$ are both zero), you can take $P(v,-u,0)$ and $Q(u*w,v*w,-(u^2+v^2))$. normalize them (i.e., divide them by their norm) yielding vectors $Q'$ and $R'$. Then take all the dot products $x_k=Q'.P_k$ and $y_k=R'.P_k$ ; points $(x_k,y_k)$ will constitute your projected set of points.
Remarks: If you work with a software in which it is easy to program matrices, it suffices to "assemble" the 2 lines $\times$ 3 columns matrix $B$ having as its first line the coord. of $Q'$ and on its second line those of $R'$, and then multiply matrix $B$ by $C$ where $C$ is the $3$ lines and $n$ columns of the matrix whose $i$th column is constituted by the 3D coord. of the $k$th point in 3D.