Fidn intersection of two points parametrically, with two variables

sognostella
Messages
4
Reaction score
0
1. A better way to find the point of intersection of two lines is parametrically as two linear interpolations b/w inital and final points.

x=(1-s)x1+sx2
y=(1-s)y1+sy2

where x1 and y1 are the inital points and x2,y2 are the final points.
(-6,-6) (5,2)

x=(1-t)x3+tx4
y=(1-t)y3+ty4
where x3 and y3 are the inital points and x4 &y4 are the final points.
(3,-3) (1,3)




2. how do you find intersection with these two variables



3. The Attempt at a Solution
set x(t)=y(t) and solve for t
t= (x3-y3)/(x3-x4-y3-y4)
set t into the x(t) & y(t)

x(s)=y(s)
s= (x1-y1)/(x1-x2-y1-y2)
set s into the x(s) & y(s)

then set x(s)=x(t) and y(s)=y(t)


What did i do wrong?

Another attempt:
setting set x(s)=x(t) and y(s)=y(t), gives me two equations with unknown (s &t) after i find s and t i can plug one into the equations to find intersection. but how do i find s or t?
 
Physics news on Phys.org
You don't set "x(t)= y(t)"- the x and y coordinates of the point of intersection are not necessarily the same!

Instead, set the x(t)= x(s) and y(t)= y(s). That is, at the point of intersection, the x values from the two equations are the same and the y values of the two equations are the same.

Also, you should go ahead and replace the coeffients in the equations with the actual values. You are told, for example, that the first line is given by
"x=(1-s)x1+sx2
y=(1-s)y1+sy2

where x1 and y1 are the inital points and x2,y2 are the final points.
(-6,-6) (5,2)"
So put those in: x= (1-s)(-6)+ s(5), y= (1- s)(-6)+ s(2)
which reduce to x= -6+ 6s+ 5s= 11s- 6, y= -6+6s+ 2s= 8s- 6.

and you are told that, for the second line,
"x=(1-t)x3+tx4
y=(1-t)y3+ty4
where x3 and y3 are the inital points and x4 &y4 are the final points.
(3,-3) (1,3)
so that x= (1- t)(3)+ t(1) and y= (1- t)(-3)+ t(3) which reduce to
x= 3- 3t+ t= 3- 2t and y= -3+ 3t+ 3t= 6t- 3.

The point of intersection lies on both lines of course, so must satisfy both sets of equations:
x= 11s- 6= 3- 2t and y= 8s- 6= 6t+ 3.

That gives you two equations to solve for s and t which you can then put back into either set of equations to find the point.
 
the values I'm given are for checking that you have solved correctly. I'm have to make a program on matlab, that while work for any values of x1,x2,x3,x4,y1,y2,y3 or y4.

Sorry for not being more specific.

And thank you for your reply!
 
My friend is doing this same problem and his way of solving got him this:

s = (y3-y1+(-x1*y3+x3*y3+x1*y4-x3*y4)/(x4-x3))/(y2-y1+(-x1*y3+x2*y3+x1*y4-x2*y4)/(x4-x3));
t = (x1-s*x1+s*x2-x3)/(x4-x3)

he's not here to explain, but i can't seem to get similar answer for s equal.
I get how he for t. but...
 
I still can't figure this out.. .anyone out there... know how to solve this??
 
There are two things I don't understand about this problem. First, when finding the nth root of a number, there should in theory be n solutions. However, the formula produces n+1 roots. Here is how. The first root is simply ##\left(r\right)^{\left(\frac{1}{n}\right)}##. Then you multiply this first root by n additional expressions given by the formula, as you go through k=0,1,...n-1. So you end up with n+1 roots, which cannot be correct. Let me illustrate what I mean. For this...
Back
Top