Vector question


#1

If I have a vector that I am comparing with a list of other vectors, would I be correct in assuming that the vector in the compare list that has the smallest dot product with the original vector will be the one that is most closely aligned with the original ?

Or should I just use rs.VectorAngle and find the vector in the list that returns the smallest angle with the original?

Thanks,
–MItch


(Menno Deij - van Rijswijk) #2

the dot product is defined as a*b=|a||b|cos(alpha)

So, the smallest dot product will give you perpendicular vectors, not parallel vectors, as cos(0) = 1.

So you’d be looking for the dotproduct of normalized vectors that are close to 1.

Also: what does comparing vectors mean in your context: only direction, or also length? If length is important you must take that into account as well.


#3

OK, thanks Menno, don’t know why I got it backwards… only direction is important in this case…
Cheers,
–Mitch