PDA

View Full Version : Math: Calculation of view vector normals



BenBE
18-10-2004, 06:51 PM
I'v the following problem:

I'v a viewing vector that represents the Z-Axis (given) of the image and want to calculate the X- and Y-Axis out of this vector which is the normal of the X and Y vectors (wanted).

For a non-rotated view vector, i.e. Z = (0,0,1), there's not much a problem, because X = (1,0,0) and Y = (0,1,0).

But the problem comes when I need the X and Y vector when I don't know how the Z vector was rotated, e.g. when Z = (1,2,3).

Is there another way to transform X and Y without needing to calculate the angles that Z was rotated by?

Could somebody give me information on this matter, please?

TIA,
BenBE.

peterbone
20-10-2004, 01:14 PM
You don't have enough information to calculate x and y given just z. If you think about it you can rotate x and y around the z axis and z won't change - so there are an infinite number of possibilities for x and y.
You need another constraint to calculate x and y. If you can visualize the way you want the axis to move then you should be able to work out what the other constraint is - maybe you want the x-axis to stay parallel to the world x-z plane or something.

Peter