### Tags: curves, defined, dimensions, functions, intersection, matlab, parametric, programming, sox1, variable

# Intersection of two 3D parametric curves

On Programmer » Matlab

2,007 words with 3 Comments; publish: Tue, 29 Apr 2008 14:40:00 GMT; (20062.50, « »)

Hi, I have two parametric curves defined in three dimensions, which are func

tions 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 so

me 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 obta

in y as a function of x. Wi

th three dimensions, I cannot do this.

Any idea of how I should approach this problem? Thanks!

*http://matlab.todaysummary.com/q_matlab_32096.html*

All Comments

Leave a comment...

- 3 Comments
- JFG wrote:
> Hi, I have two parametric curves defined in three dimensions, which are fu

nctions 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 dif

ficulty 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=.matlab.todaysummary.com.(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

#1; Tue, 29 Apr 2008 14:41:00 GMT

- JFG wrote:
- I guess I should mention that I am interested in an analytical solution. Sor
ry, I should have mentioned that in the original post.

#2; Tue, 29 Apr 2008 14:42:00 GMT

- I guess I should mention that I am interested in an analytical solution. Sor
- 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...

#3; Tue, 29 Apr 2008 14:43:00 GMT

- JFG wrote: