Heater wrote: ↑Thu Oct 24, 2019 10:53 am
Where does that BBC BASIC get it's planetarium data from?
I've included web links in the source code, preceding the blocks of DATA statements at the end of the program. No guarantees that they are the 'best' sources nor that they are the most accurate, just ones that Google found.
As I mentioned, the program is based on an
old BBC Micro program of the same name, but I've been able to take advantage of the greatly increased memory and features of later BBC BASICs, like the array dot-product, to improve it.
In particular the rotation of the 'celestial sphere' (a set of 9,000 or so 3D star coordinates) into the correct frame-of-reference for the orientation of the earth, the observer's latitude and longitude, and the telescope's pan and tilt, is achieved with this code:
Code: Select all
REM Rotate around x-axis by camera/telescope tilt (zero towards horizon):
rot() = 1, 0, 0, 0, COSRAD(tilt), SINRAD(tilt), 0, -SINRAD(tilt), COSRAD(tilt)
REM Rotate around z-axis by camera/telescope pan (zero towards North):
tmp() = COSRAD(pan), -SINRAD(pan), 0, SINRAD(pan), COSRAD(pan), 0, 0, 0, 1
rot() = rot() . tmp()
REM Rotete around x-axis by observer's co-latitude:
tmp() = 1, 0, 0, 0, SINRAD(LAT), COSRAD(LAT), 0, -COSRAD(LAT), SINRAD(LAT)
rot() = rot() . tmp()
REM Rotate around z-axis by observer's sidereal time:
tmp() = COSRAD(LST*15), SINRAD(LST*15), 0, -SINRAD(LST*15), COSRAD(LST*15), 0, 0, 0, 1
rot() = rot() . tmp()
REM Apply composite rotation matrix to celestial sphere:
xyz() = rot() . XYZ()
I venture to suggest that this would be a lot less elegant in most other languages.