Jeph Jacques's comics discussion forums

Fun Stuff => CHATTER => Topic started by: YourBuddyBill on 26 Apr 2015, 15:16

Title: I need help with vector math
Post by: YourBuddyBill on 26 Apr 2015, 15:16
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)
Title: Re: I need help with vector math
Post by: Pilchard123 on 26 Apr 2015, 15:24
(click to show/hide)

(click to show/hide)

(click to show/hide)
Title: Re: I need help with vector math
Post by: osaka on 26 Apr 2015, 15:27
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.
Title: Re: I need help with vector math
Post by: YourBuddyBill on 26 Apr 2015, 17:29
Got it, thanks, it's working.
As it turns out, the real thing that I didn't get was axis angles (which are confusing)