Closest point between two vectors



Ive seen a thread for finding the closest point between two lines:

But is there any way to find the closest point between two vectors? (Similar, I know, but it would be really helpful to find this specific result rather than creating two lines and testing them).

(Radovan Grmusa) #2

“Vectors” can be moved freely by definition, so all vectors might have the distance 0 or any another number.

Do you mean lines, which require on point and a direction vector as a definition?
Or do you mean the distance between the points these vectors point to from the origin?

(Michael Pryor) #3

But is there any way to find the closest point between two vectors?

it would be where the vectors intersect. Vectors are infinite, unless there is a length, then it is a line.


To clarify:

They are two vectors that do not intersect. Given that they are infinite (and not parallel/co-planar) there must exist a point of closest proximity. Is there a gh tool for that? I would have assumed the CP-2-Lines could find it but I get an error when I try to connect vectors to the curve inputs.

(Pfotiad0) #5

I confess that I can’t get it:

Vectors are directions (you can think of them as “rays” originated from Plane.WorldXY.Origin: kinda the rays from a light source).

If you “apply” a vector to, say, a point (i.e. p+/-v) then the point is moved “along” that direction. Same with some Translate trans related with a given geometry etc etc. With these in mind … the term vector intersection has no meaning (but a vector angle [with respect a given plane] and/or Dot/Cross products have).

If you have 2 pts (p1, p2) and 2 vectors(v1,v2) then you can have 2 lines. Then there’s various Methods for finding min/max distance using finite or not segments.

(David Rutten) #6

As has been mentioned, the question makes no sense for vectors, they intersect everywhere and nowhere. You need the Line Line intersection, which means you must first convert your vector directions into lines, which involves you specifying a point on each line. This point, which is not part of the vector definition, fully controls where, if at all, two lines will intersect.