Got Questions? Get Answers.
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Intersection of two lines

Subject: Intersection of two lines

From: edward kabanyas

Date: 8 Feb, 2012 01:43:09

Message: 1 of 2

Hi all,

I have time-longitude data consisting westward and eastward propagation cloud movement. I plot this two data into time-longitude space. I have calculated the trajectory of the movement; start and end point of both westward and eastward propagation.

For westward, the trajectory of the movement is plotted as:

for i=1:1: length(yrw)
line([Lonbeginw(i) Lonendw(i)],[DateNumberbGnw(i) DateNumberEndw(i)],[0.1 0.1],'LineStyle','-', 'LineWidth',2, 'Color','r')
end

For eastward, the trajectory is plotted as

for i=1:1: length(yre)
line([Lonbegine(i) Lonende(i)],[DateNumberbGne(i) DateNumberEnde(i)],[0.1 0.1],'LineStyle','-', 'LineWidth',2, 'Color','g')
end

Question: I would like to examine when the two lines (westward and eastward) intersect each other for all dataset (length(yrw) for westward and length(yre) for eastward). Any suggestion for this matter ?

Thanks for help

Subject: Intersection of two lines

From: Bruno Luong

Date: 8 Feb, 2012 07:48:21

Message: 2 of 2

"edward kabanyas" <djuky_hmi@yahoo.com> wrote in message <jgsjvd$728$1@newscl01ah.mathworks.com>...
> Hi all,
>
> I have time-longitude data consisting westward and eastward propagation cloud movement. I plot this two data into time-longitude space. I have calculated the trajectory of the movement; start and end point of both westward and eastward propagation.
>
> For westward, the trajectory of the movement is plotted as:
>
> for i=1:1: length(yrw)
> line([Lonbeginw(i) Lonendw(i)],[DateNumberbGnw(i) DateNumberEndw(i)],[0.1 0.1],'LineStyle','-', 'LineWidth',2, 'Color','r')
> end
>
> For eastward, the trajectory is plotted as
>
> for i=1:1: length(yre)
> line([Lonbegine(i) Lonende(i)],[DateNumberbGne(i) DateNumberEnde(i)],[0.1 0.1],'LineStyle','-', 'LineWidth',2, 'Color','g')
> end
>
> Question: I would like to examine when the two lines (westward and eastward) intersect each other for all dataset (length(yrw) for westward and length(yre) for eastward). Any suggestion for this matter ?

You might adapt this function to your need:

http://www.mathworks.com/matlabcentral/fileexchange/27673-2d-polygon-edges-intersection

% Bruno

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us