Path: news.mathworks.com!not-for-mail
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$1@newscl01ah.mathworks.com>
References: <ista6g$okq$1@newscl01ah.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: www-02-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: newscl01ah.mathworks.com 1307717420 27596 172.30.248.47 (10 Jun 2011 14:50:20 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 10 Jun 2011 14:50:20 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 756104
Xref: news.mathworks.com comp.soft-sys.matlab:731305

"shah baba" <shahbaba@gmx.de> wrote in message <ista6g$okq$1@newscl01ah.mathworks.com>...
> 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