Finding orthogonal vector
This is a bit of a math question, but I'll ask it here partly because I don't belong to any math forums, and partly because the computational complexity of the answer is important.
Given two vectors i and j, how can I efficiently calculate the vector k which is orthogonal to i and lies on the plane defined by i and j (in math jargon, I think this implies i * k = 0 and k * (i x j) = 0)? Also, |i| = |j| = 1, if that helps.
The only way I could come up with, with my limited knowledge of the subject, was to construct an arbitrary orthonormal basis in which i represents the z axis, transform j to that coordinate system, zero the z component of the transformed vector, then transform it back to world space and normalize it. It seems like there should be a less complex solution, however. Any thoughts?
Edit: Upon further thought, would i x (i x j) do the trick?
Re: Finding orthogonal vector
Yeah, it is a lot simpler: Given the vectors A and B.
The vector C = B - A (AB) / (AA) is orthogonal to A and in the (A, B) plane.