Fun Stuff > CHATTER

I need help with vector math

(1/1)

YourBuddyBill:
I don't understand vector math in 3D.
What I need to do is take an arbitrary vector (x, y, z) and get another two vectors that are "perpendicular" to it. The "perpendicular" vectors are "horizontal" and "vertical"; the "horizontal" perpendicular vector should have no z component at all (in other words, it should be parallel to the "ground" xy plane) and the "vertical" perpendicular vector should be perpendicular to both the "horizontal" and the "original" vector. I could probably use a cross product to get the vertical one out of the other two, but that still leaves me not knowing how to calculate the horizontal one. Any ideas?
(ideally the vectors should all have the same length, but if it's easier without doing that, i could scale them all to the unit vector before scaling them outward again)

Pilchard123:
(click to show/hide)Remember that two vectors are perpendicular if their scalar/dot product is exactly zero.
(click to show/hide)The scalar product of two vectors a and b is given by |a||b|cos(θ) and also - if you have the two vectors as (ax, ay, az) and (bx, by, bz) - by axbx + ayby + azbz.

(click to show/hide)Since it is given that the second vector must have no z-component, you can ignore the third term in calculating the scalar product:
axbx + ayby = 0

osaka:
As third hint, the vectorial product of any two vectors will return a vector that's perpendicular to both of them, if I recall correctly.

YourBuddyBill:
Got it, thanks, it's working.
As it turns out, the real thing that I didn't get was axis angles (which are confusing)

Navigation

[0] Message Index

Go to full version