问题
i'm new to Swift, and now i'm trying to build sky map app like the application "star chart".
i already got a sky map image from NASA and cover it on SCNsphere, also already set camera node in the center of this sphere to make it looks like 360 degrees. Furthermore, i used accelerator to check what direction the camera is looking at.
i know that the sky map like “star chart” doesn't need internet to update data. so now the biggest problem is that i don't know how to correct the position of my sky map according to people's current time and location.
Any good advice and help? Thanks in advance!!! cause i tried vary hard to find some related information but still stuck in here for three weeks.
回答1:
You just need to rotate your map with time+longitude
around Earth's rotation axis and with latitude
around axis longitude=90 degrees
while earth is placed in the center of your sphere. For stars the offset does not matter so you can ignore Sun-Earth distance and also Earth's radius as well.
The time rotation must be day+year
rotations together. On top of that you have to apply precession and nutation if you want to have higher precision.
Of coarse the stars are moving too so if you need really high precision and or high time interval to cover (hundreds or thousands of years) then this approach is not good and you should use stellar catalog with the motions implemented.
For more info see related:
- How to draw sky chart
- Plotting a star chart efficiently
If you want to use catalog and real colors then you will also need
- Star B-V color index to apparent RGB color
- simplified atmospheric scattering GLSL shader
And finally here some hints for such applications:
- Is it possible to make realistic n-body solar system simulation in matter of size and mass?
来源:https://stackoverflow.com/questions/39961397/swift-how-can-i-correct-sky-map-according-to-current-time-and-location