From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: angle between two vectors
Date: Fri, 10 Jun 2011 14:50:20 +0000 (UTC)
Organization: Boeing Co
Lines: 15
Message-ID: <istavc$quc$>
References: <ista6g$okq$>
Reply-To: <HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: 1307717420 27596 (10 Jun 2011 14:50:20 GMT)
NNTP-Posting-Date: Fri, 10 Jun 2011 14:50:20 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 756104
Xref: comp.soft-sys.matlab:731305

"shah baba" <> wrote in message <ista6g$okq$>...
> hi
> I have a vector n1 of pt1[x1,y1,z1] from origin [0,0,0] and n2 of p2[x2,y2,z2]from origin [0,0,0].
> The angle between n1 and n2
>                             n1 . n2           
>         cos q  =    ---------------------             
>                          ||n1|| ||n2|| 
> How can I decompose angle (q) it into  its three components(alpha, beta gamma) 
> regards,

Please define alpha, beta, and gamma. Are they some type of Euler Angle sequence? Or what?

Also, using the above formula is not the most robust way of getting the angle. There are several old newsgroup discussions of this, but it basically boils down to using both sin (with a cross product) and cos (with a dot product as you have used) and then feeding that to the atan2 function to get the angle.

James Tursa