0
$\begingroup$

I'm working on a 3D perspective game and it would help if you could answer this:

Plane $P$ is defined as: $xf \cdot x + yf \cdot y + zf \cdot z + G = 0$

I know point $p$ $(xp, yp, zp)$ and point $f$ $(xf, yf, zf)$, and they each lie on plane $P$.

$xf, yf, zf, G, xp, yp, zp$ are all known.

I am looking for some point $q$'s coordinates. Point $q$ lies on plane $P$. Angle pqf forms a right angle.

*NOTE *: $f$ is at the same height as $q$ ($zq = zf$) and $p$ is above $q$.

I tried to use the dot product rule as well as the intersection of three planes in order to find point q, but it seemed there were too many unknown variables (which doesn't make sense to me).

Please help! Thanks.

$\endgroup$
0
$\begingroup$

You have three variables for the point $Q = (Q_x,Q_y,Q_z)$. You have that $\angle PQF$ is right angle hence $(P-Q) \cdot (F-Q) = 0$. Also you have that $Q_z = F_z$ and finally you have that $xf \cdot Q_x + yf \cdot Q_y + zf \cdot Q_z + G = 0$, as $Q$ lies on the plane. These three equation should give a solution (whenever possible) for $Q = (Q_x,Q_y,Q_z)$.

$\endgroup$
1
  • $\begingroup$ when I do that I get too long an equation and can't solve for Qx, Qy, and Qz. $\endgroup$ – fatpiginmud Jul 18 '17 at 20:48
0
$\begingroup$

Any point (other than $p$ or $q$ themselves) on the circle that has $p$ and $q$ as endpoints of a diameter and lies within the plane will create the right angle you’re looking for. As a practical way finding such a point, rotate either $p$ or $q$ about the normal to the plane through their midpoint.

Alternatively, once you’ve found the midpoint $c$, you can use a series of cross products to find a vector that’s orthogonal to both the plane normal and $p-c$ (and also $q-c$). Adjust its length to equal $\|p-c\|$.

$\endgroup$
1
  • $\begingroup$ Excellent suggestion, amd. Especially because one can implement the rotation using Rodrigues' rotation formula, which for a ±90° rotation boils down to $$\vec{v}' = \hat{k} \times \vec{v} \pm \hat{k} ( \hat{k} \cdot \vec{v} )$$where $\hat{k}$ is the unit vector representing the rotation axis; here, $\hat{k} = f / \lVert f \rVert = f / \sqrt{f \cdot f}$, $\vec{v} = ( \vec{q} - \vec{p} ) / 2$, and the resulting point $r$ is $\vec{p} + \vec{v} + \vec{v}'$ making $\angle prq = 90°$. $\endgroup$ – Nominal Animal Jul 13 '17 at 8:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.