comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Calculate the included angle between two vectors
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Calculate the included angle between two vectors [message #65972 is a reply to message #65971] Fri, 10 April 2009 02:15 Go to previous messageGo to previous message
duxiyu@gmail.com is currently offline  duxiyu@gmail.com
Messages: 88
Registered: March 2007
Member
Thanks all.


On Apr 10, 1:41 am, Chris <beaum...@ifa.hawaii.edu> wrote:
> On Apr 9, 5:43 am, Pierre <pierre.villene...@gmail.com> wrote:
>
>> On Apr 9, 7:14 am, "dux...@gmail.com" <dux...@gmail.com> wrote:
>
>>> Is there a function which can calculate the included  angle between
>>> two three-dimensional vectors?
>
>>> jdu
>
>> Here's a simple solution.  Assume v1 and V2 are each three-element
>> vectors of any magnitude.  Compute the angle in degrees as follows:
>
>> angle = acos( transpose(v1)#v2 / sqrt(total(v1^2)) / sqrt(total
>> (v2^2)) ) * 180./!pi
>
>> Good luck.
>
> There is an issue with this method due to the fact that acos cannot
> distinguish between positive and negative angles (cos(-theta) = cos
> (theta)).
> I have found this website to be very useful for coding geometry type
> problems like this one:http://local.wasp.uwa.edu.au/~pbourke/geometry/
>
> chris
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Filling Contour with Patterns
Next Topic: Re: ENVI_INIT_TILE tiling problem

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sat Oct 11 09:46:24 PDT 2025

Total time taken to generate the page: 1.04297 seconds