I have a vector A, and I have a plane P consisting of a point (Pp) and normal (Pn)
I need to find the vector B, that is orthogonal to A and also on P. To prevent infinite solutions, lets make B unit length.
If V is perpendicular to P there are infinite, we can ignore this case, as in my application it will never occur.
As far as I can see in every other case there will be two vectors.
We have 3 unknowns and therefore need three equations:
1) A and B are orthogonal, therefore their dot product is zero
(A.x * B.x) + (A.y * B.y) + (A.z * B.z) = 0
2) If B is in the plane P, then there are orthogonal and the dot product between B and Pn is zero
(B.x * Pn.x) + (B.y * Pn.y) + (B.z * Pn.z) = 0
3) B will be unit length
sqrt(B.x^2 + B.y^2 + B.z^2) = 1
Now I assume I could plug these into a fancy equation solver and find vector B (and its negation), butI was hoping there is a more specific / optimized approach.