math - x,y,z polar coordinates in a sphere -


i using following math x,y,z coordinates assumed hypotenuse of 150 , known yaw pitch , roll.

float zpos = (float)math.tan(math.toradians(rmpitch-90))*150; float xpos = (float)math.cos(math.toradians(90-rmyaw))*150; float ypos = (float)math.cos(math.toradians(rmyaw))*150; 

assuming viewer standing @ 0,0,0 , looking @ p. q 150 units away , know yaw , pitch of view);

my math seems work fine until pitch gets closer straight , down, @ point realize x , y need take account z in manner.. please help

assumine viewer standing @ 0,0,

the easiest way think think unit circle embedded in plane containing p , z axis. there, vector q 1 side of triangle, , pq other. so, armed picture in head:

first, z should cos(pitch), not tan(pitch). then, correct x, y pitch, multiply them sin(pitch).

note assuming did intend phi/pitch angle between z axis , vector (and not more standard angle between x-y plane , vector).


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -