0
\$\begingroup\$

In 3d space, is there any way to project a vector onto a plane, but alongside the UP vector (0,1,0) instead of the plane normal? If so, then how do I do that and what is it called?

\$\endgroup\$

1 Answer 1

1
\$\begingroup\$

Given a plane with normal vector \$\vec n\$ and any arbitrary point \$\vec p\$ on that plane, then for any other point \$\vec p^\prime\$ in that plane the following equation holds:

$$\vec n \cdot \vec p ^ \prime = \vec n \cdot \vec p$$

Now let's take your off-plane point \$\vec q = (q_x, q_y, q_z)\$. We're going to slide it along the y axis to a new point \$\vec q ^\prime = (q_x, y, q_z)\$ so that it lies in that plane. That means...

$$\begin{align}\vec n \cdot \vec q^\prime &= \vec n \cdot \vec p\\ n_x q_x + n_y y + n_z q_z &= \vec n \cdot \vec p\\ n_y y &= \vec n \cdot \vec p - n_x q_x - n_z q_z\\ y &= \frac {\vec n \cdot \vec p - n_x q_x - n_z q_z} {n_y} \end{align}$$

So, substitute your normal, point on plane, and x/z coordinates of your off-plane point \$ \vec q\$, and you'll get the new y coordinate that will project it vertically onto this plane.

\$\endgroup\$
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .