Skip to main content
GameDev.net gamedev.net
🔒 Locked

Simple 3D trigonometry.

Started by frogtag Jun 11, 2009 at 1:37 PM 0 replies 1.9k views
Original Post
frogtag
frogtag
Can someone check this psuedo code for me please. It's for working out the x,y,z coords for a sphere using 2 angles, horizontal and vertical and the radius of the sphere. It doesn't seem to work properly. x = radius * cos(vert angle) * sin(hoz angle); y = radius * cos(hoz angle); z = radius * sin(vert angle) * sin(hoz angle);
alvaro
alvaro
The more familiar names for the "horizontal angle" and the "vertical angle" are "latitude" and "longitude".

Try these, where latitude is in [-pi/2,pi/2] and longitude is in [-pi,+pi]:
x = radius * cos(longitude) * cos(latitude)
y = radius * sin(latitude)
z = radius * sin(longitude) * cos(latitude)

[Edited by - alvaro on June 11, 2009 6:28:37 PM]

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.