Jeph Jacques's comics discussion forums

  • 22 Feb 2019, 08:32
  • Welcome, Guest
Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: I need help with vector math  (Read 489 times)

YourBuddyBill

  • Obscure cultural reference
  • **
  • Offline Offline
  • Posts: 144
  • Abasement Dweller
I need help with vector math
« 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)
Logged
I have a lot of issues. Sometimes I'm a jerk without meaning to be one, so call me out on it, because that helps me learn. Also I talk way too much.
There used to be invisible text here but i deleted it because it was a stupid gimmick anyway.

Pilchard123

  • Vulcan 3-D Chess Master
  • *****
  • Offline Offline
  • Posts: 3,816
  • I always name them Bitey.
Re: I need help with vector math
« Reply #1 on: 26 Apr 2015, 15:24 »

(click to show/hide)

(click to show/hide)

(click to show/hide)
« Last Edit: 26 Apr 2015, 15:30 by Pilchard123 »
Logged
Piglet wondered how it was that every conversation with Eeyore seemed to go wrong.

osaka

  • Scrabble hacker
  • *****
  • Offline Offline
  • Posts: 1,434
Re: I need help with vector math
« Reply #2 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.
Logged
Meh, if you have to run fsck, you're already fscked.

YourBuddyBill

  • Obscure cultural reference
  • **
  • Offline Offline
  • Posts: 144
  • Abasement Dweller
Re: I need help with vector math
« Reply #3 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)
Logged
I have a lot of issues. Sometimes I'm a jerk without meaning to be one, so call me out on it, because that helps me learn. Also I talk way too much.
There used to be invisible text here but i deleted it because it was a stupid gimmick anyway.
Pages: [1]   Go Up