CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Threaded View

  1. #1
    Join Date
    Aug 2005
    Location
    LI, NY
    Posts
    576

    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?
    Last edited by Hermit; September 16th, 2008 at 10:47 AM.
    - Alon

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured