From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: angle between two vectors
Date: Fri, 6 Aug 2010 19:18:06 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 17
Message-ID: <i3hn5d$eh7$>
References: <i3hlf0$olk$>
Reply-To: <HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: 1281122286 14887 (6 Aug 2010 19:18:06 GMT)
NNTP-Posting-Date: Fri, 6 Aug 2010 19:18:06 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: comp.soft-sys.matlab:659861

"brian adams" <> wrote in message <i3hlf0$olk$>...
> In 2-space, I have a three points: 
> c,  the ctr
> p, an arbitrary point, and
>  v, a point indicating a direction (as a vector from the ctr to v).  
> I need to determine whether the point p is in the forward direction of the vector v from the center point, c.
> I have gotten this to work by means of the law of cosines to determine the angle between the the vectors, p-c and v-c.  I needed to calculate the distances between the three points, apply acos, and determine if the abs of the angle is <= 90.
> However, this method is computational intensive for the number of points for which I need to perform this operation.
> Is there a less computationally intensive means by which to determine this?
- - - - - - -
 If dot(p-c,v-c) > 0, then p is in the "forward" direction if I interpret you correctly.  No need to find the angle or the lengths of the vectors.

Roger Stafford