3D Earthquake visualization in Processing issue

neilofbodom

Member
Hi guys,

I am attempting to create an earthquake data visualization program using Processing. I created a 3D sphere and applied a texture of the map of the Earth on it using createShape(SPHERE, radius); and setTexture();

Everything works except for a major detail...the locations of the earthquakes are off completely from their respective position. I have my data loaded into a csv file and I then convert each latitude and longitude to x,y,z positions using the following formulae:

Code:
x = r * sin(theta) * cos(phi);
y = r * sin(theta) * sin(phi);
z = r * cos(theta);

where theta is latitude in radians, phi is longitude in radians and r is the radius of my sphere.

Any idea what might be an issue? Maybe I am not considering sth?

Thanks!
 

Intel_man

VIP Member
Since those equations represent spherical coordinate system, phi should be latitude in that equation I'm pretty sure. Theta is angle of inclination relative to the Z axis.

7d6175912d0e1731adf6b7ac6e14cc814355b659


240px-3D_Spherical.svg.png
 
Top