🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Finding Orthogonal Vectors

Started by
1 comment, last by drstrangeluv 24 years, 7 months ago
A vector has an infinite number of orthogonal vectors. Do you want any one of these vectors or are there further requirements not mentioned in the original post?
Advertisement
How do you generate an orthogonal vector in 3D given you only know one vector (i.e. I know the direction the object is moving, but I want to generate a vector that's perpendicular to that vector). If convoluted math is involved, give it to me straight, I can take it.
For example

v1 (DOT) v2 = 0 gives orthogonal vectors

so you get

v1 = (a, b, c)
v2 = (x, y, z)

so ax + by + cz = 0.

This can be trivially solved by setting
any of

x=y=1 and so z = -(a+b)/c (if c != 0)
x=z=1 so y = -(a+c)/b (if b!=0)
y=z=1 so x = -(b+c)/a (if a!=0)

Once you've done this once,
the third vector can be generated by taking the cross of the two vectors, defined by

(bz-cy, cx-az, ay-bx) = (a1, b1, c1)


Anyway,
HTH.

signing off,
mikey

This topic is closed to new replies.

Advertisement