MathGroup Archive 2002

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Generating Two Unit Orthogonal Vectors to a 3D Vector

  • To: mathgroup at smc.vnet.net
  • Subject: [mg36366] Re: Generating Two Unit Orthogonal Vectors to a 3D Vector
  • From: Selwyn Hollis <slhollis at earthlink.net>
  • Date: Tue, 3 Sep 2002 01:41:09 -0400 (EDT)
  • References: <akv7s5$fl8$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

My 2 cents' worth:


OrthogonalUnitVectors[v:{_, _, _}] :=
   With[{u = Which[
             (w = {0,v[[3]],-v[[2]]}).w != 0, w,
             (w = {v[[3]],0,-v[[1]]}).w != 0, w,
             (w = {v[[2]],-v[[1]],0}).w != 0, w ] },
   #/Sqrt[#.#]& /@ {u, Cross[u,v]}]


---
Selwyn Hollis



David Park wrote:
> There are many cases in graphics, and otherwise, where it is useful to
> obtain two orthogonal unit vectors to a given vector. I know a number of
> ways to do it, but they all seem to be slightly inelegant. I thought I would
> pose the problem to MathGroup. Who has the most elegant Mathematica
> routine...
> 
> OrthogonalUnitVectors::usage = "OrthogonalUnitVectors[v:{_,_,_}] will return
> two unit vectors orthogonal to each other and to v."
> 
> You can assume that v is nonzero.
> 
> David Park
> djmp at earthlink.net
> http://home.earthlink.net/~djmp/
> 
> 




  • Prev by Date: Re: Generating Two Unit Orthogonal Vectors to a 3D Vector
  • Next by Date: Re: I want to get the coefficient of the Legendre-Gauss Quadrature
  • Previous by thread: Re: Generating Two Unit Orthogonal Vectors to a 3D Vector
  • Next by thread: Re: Generating Two Unit Orthogonal Vectors to a 3D Vector