3D coordinates on a sphere to Latitude and Longitude

后端 未结 7 751
慢半拍i
慢半拍i 2020-11-30 19:25

I\'ve got the following information:

There exists a sphere with origin (0,0,0) and radius R. After doing a ray-sphere intersection I know a point (XYZ) in 3D space t

7条回答
  •  谎友^
    谎友^ (楼主)
    2020-11-30 20:20

    r=sqrt(x^2+y^2+z^2)  
    phi = arccos(sqrt(x^2+y^2)/r)*sign(y)  
    lambda = arccos(x/sqrt(x^2+y^2))  
    latitude = 180/pi * phi  
    longitude = 180/pi * lambda 
    

    you might have to tinker with the signs a little

提交回复
热议问题