Jump to content

  • Log In with Google      Sign In   
  • Create Account


Kepakiano

Member Since 27 Oct 2012
Offline Last Active Mar 09 2013 06:14 AM

#5026054 Generate random perpendicular unit vector

Posted by Kepakiano on 27 January 2013 - 08:17 AM

This is what I would do:
http://pastebin.com/fr4aU0cw (needs C++11)

1. Generate a random unit vector
2. Make it orthogonal to your given vector by using the Gram-Schmidt Process (http://en.wikipedia.org/wiki/Gram%E2%80%93Schmidt_process)

Edit: The snippet does not check, whether v and random u are linearly independent.


PARTNERS