Scope: Cosmus homepage  
Home Page Downloads Projects Tech Notes About Us


Converting latitude and longitude to x y z coordinates in Partiview

If you are given latitude and longitude (in degrees) for some place on earth. Latitude is between -90 and 90, and longitude between -180 and 180. Suppose that the model of earth you're using has radius R. Then the following formulae produce x y z coordinates for that place :

    LAT = latitude * pi/180
    LON = longitude * pi/180
    x = -R * cos(LAT) * cos(LON)
    y =  R * sin(LAT) 
    z =  R * cos(LAT) * sin(LON)