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 3D parametric curves

Subject: Intersection of two 3D parametric curves

From: Eric Carlson

Date: 2 Feb, 2007 15:52:10

Message: 1 of 4

JFG wrote:
> Hi, I have two parametric curves defined in three dimensions, which are functions of a variable t, like so:
>
> x1 = f1(t)
> y1 = f2(t)
> z1 = f3(t)
>
> x2 = f4(t)
> y2 = f5(t)
> z2 = f6(t)
>
> I am trying to find the intersection of these two curves, but I am having some difficulty with the mathematics. In two dimensions, I simply solve for t as a function of x, and then plug that value of t into my y function to obtain y as a function of x. With three dimensions, I cannot do this.
>
> Any idea of how I should approach this problem? Thanks!
%x1,x2..already defined as functions
guess = whatever;
dist=@(t) norm( x2(t)-x1(t), y2(t)-y1(t),z2(t)-z1(t));
fminsearch(dist, guess)

I'll let you at least figure out how to tell if they intersect -
hope it's not homework.

Cheers,
Eric Carlson

Subject: Intersection of two 3D parametric curves

From: Eric Carlson

Date: 2 Feb, 2007 17:56:23

Message: 2 of 4

JFG wrote:
> I guess I should mention that I am interested in an analytical solution. Sorry, I should have mentioned that in the original post.
norm(vx,vy,vz)=sqrt(vx^2+vy^2+vz^2)

presuming x1, x2, y1,y2,z1,and z2 are all defined, you can take
derivative of norm and...

Subject: Intersection of two 3D parametric curves

From: dfd invl

Date: 29 Jan, 2009 18:04:07

Message: 3 of 4

Eric Carlson <ecarlson@coe.eng.ua.edu> wrote in message <ioOwh.33$FX6.13@newsfe02.lga>...
> JFG wrote:
> > Hi, I have two parametric curves defined in three dimensions, which are functions of a variable t, like so:
> >
> > x1 = f1(t)
> > y1 = f2(t)
> > z1 = f3(t)
> >
> > x2 = f4(t)
> > y2 = f5(t)
> > z2 = f6(t)
> >
> > I am trying to find the intersection of these two curves, but I am having some difficulty with the mathematics. In two dimensions, I simply solve for t as a function of x, and then plug that value of t into my y function to obtain y as a function of x. With three dimensions, I cannot do this.
> >
> > Any idea of how I should approach this problem? Thanks!
> %x1,x2..already defined as functions
> guess = whatever;
> dist=@(t) norm( x2(t)-x1(t), y2(t)-y1(t),z2(t)-z1(t));
> fminsearch(dist, guess)
>
> I'll let you at least figure out how to tell if they intersect -
> hope it's not homework.
>
> Cheers,
> Eric Carlson

Hmm I to having similar problem.
First I changed the usage of norm so that it read:-
dist = @(t) norm( [x2(t)-x1(t) y2(t)-y1(t) z2(t)-z1(t)] )
ie square bracket and no comma, as it was only way I could get it to give me without error, is this already an incorrect step?

THen when I try fminsearch and substitute a starting seed value for 'guess', I end up with a value which I assume to be the value for 't' where the norm function gave me a minimum, ie the 't' value for the point of intersection, is this again an incorrect statement??
As when I plug this t value I get different coordinates for when I substitue into the first set of parametric equations than with the second, a little confused with how this is working?...

Subject: Intersection of two 3D parametric curves

From: Roger Stafford

Date: 29 Jan, 2009 18:44:01

Message: 4 of 4

"dfd invl" <73213@mt2009.com> wrote in message <glsr2n$nmt$1@fred.mathworks.com>...
> .....
> Hmm I to having similar problem.
> .....

  Perhaps one way to simplify this problem is to realize that any three-dimensional intersection of the two parametric curves also represents an intersection of the projection of the curves on, say, the x-y plane. Therefore all you have to do is find all the x-y plane intersections and check each one to see if the two corresponding z values are equal. This should work whether the problem is being done analytically or numerically. Of course if there are points of the curve that are oriented orthogonally to the x-y plane, there could be difficulties there.

Roger Stafford

Tags for this Thread

No tags are associated with 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