Maths is not a strong skill of mine, but I'm not afraid of it either. A mathamatical poblem I recently needed to solve was to plot a point in 3d space on a sphere.
I needed to project points using the latitude and longitude coordinate system on both a plane and a sphere. The plane was simple, but the sphere was more tricky.
The formula I settled on is bellow. I had to add 90° to the latitude otherwise I found it would only plot for one hemesphere.
y = radius * Math.cos(latitude+90°);
x = radius * Math.cos(longitude) * Math.sin(latitude + 90°);
z = radius * Math.sin(longitude) * Math.sin(latitude + 90°);
No comments:
Post a Comment