开发者

Rotate sphere based on lat/lng

开发者 https://www.devze.com 2023-01-16 08:28 出处:网络
Ok so i have an api to a globe that I can only move by setting the x y z axis tilt. (the camera cannot move.) I need to be able to map lat/lng to it. So basically take lat/lng and 开发者_运维技巧rotat

Ok so i have an api to a globe that I can only move by setting the x y z axis tilt. (the camera cannot move.) I need to be able to map lat/lng to it. So basically take lat/lng and 开发者_运维技巧rotate in x y z and show the point in the center of the screen.

The setup can basically be visualized with this picture... http://en.wikipedia.org/wiki/File:ECEF.png

One other thing, the globe is offset in Z such that the prime meridian is at 0 0 135 tilt.

Thank you.


So, This might be a bit late for your use but if you have your latitude and longitude angles as Theta (lat) and Phi (long) then the following rotation will move your point to the center of the screen

Here I assume that the north pole is at (0,0,1) i.e z=1

First set X axis tilt as -Theta Then set Z axis tilt as -Phi

This should center your point

You might need to add offsets depending on how the sphere is built

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号