View Full Version : Finding the intersection point of 2 vectors

gui24a

08-31-2008, 05:44 PM

Hi friends, I'm desperately trying to find the intersection point of two vectors. I know more or less how to find it, using the equation of a straight line, but I can't figure out on how to track 2 points of each vectors (because they are moving around the scene) to find the equation and then, finally locate the intersection point.

Could anyone please give me a light?

Thanks!

anuchka

09-02-2008, 01:40 AM

but I can't figure out on how to track 2 points of each vectors (because they are moving around the scene)

If I got your problem right ...

When your objects are moving then keep and update they current direction vector and not only coordinates

Michael Steinberg

09-07-2008, 05:38 AM

Hello!

You see, there is no such thing. Vectors represent Directions and Distances only, they don't intersect. Two lines or straights (each one represented by 2 Vectors placement and direction!) may intersect, which is what I would think you mean. Using your favourite search engine with the term "Intersection of 2 lines" should yield nice results.

Regards,

Michael

David Doria

09-07-2008, 07:33 AM

You are probably trying to find the intersection of two rays. In all but the most special case, they will not intersect at all!

You should think of a ray as a point (P) plus a length (t) times a direction (V), so

A_Point_On_The_Ray = P + tV

if you vary t from -inf to inf you get the entire line! Usually you are interested only in positive values of t though for a ray.

so you have

P1 + t1*V1 = P2 + t2*V2

There are 3 equations and 2 variables (1 equation for each dimension (ie P1x + t1V1x = P2x + t2*V2x, etc) ) So there is not necessarily a solution, but if there is, then once you find either t1 or t2, you can find the point of intersection by substituting t1 into the equation of ray 1 or t2 into the equation of t2.

Hope this helps.

Dave

Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.