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)