Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Find angle between two lines
Date: Tue, 16 Mar 2010 14:56:09 +0000 (UTC)
Organization: Xoran Technologies
Lines: 16
Message-ID: <hno669$aj9$1@fred.mathworks.com>
References: <hno4am$6ui$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1268751369 10857 172.30.248.38 (16 Mar 2010 14:56:09 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 16 Mar 2010 14:56:09 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1440443
Xref: news.mathworks.com comp.soft-sys.matlab:617272

"Natalie Sin Hwee " <sin.ng09@imperial.ac.uk> wrote in message <hno4am$6ui$1@fred.mathworks.com>...
> Hello,
> 
> i have two lines:
> - line 1 is between (0,3) and (4,3)
> - line 2 is between (0,2) and (3,0)
> 
> How can i find the angle between these two lines because their origin is not (0,0) so i cant use the vector method to find the angle. 
========

The angle between two lines is the angle between their direction vectors. The direction vectors of two lines can always be found by subtracting the position vectors of two points on the line

DirVector1=[4,3]-[0,3];
DirVector2=[0,2]-[3,0];

Angle=acos( dot(DirVector1,DirVector2)/norm(DirVector1)/norm(DirVector2) );