commit
cfb7243c91
|
|
@ -2698,8 +2698,8 @@
|
|||
"name": "Planetarium",
|
||||
"shortName":"Planetarium",
|
||||
"icon": "planetarium.png",
|
||||
"version":"0.01",
|
||||
"description": "Planetarium showing up to 350 stars using the watch location and time",
|
||||
"version":"0.02",
|
||||
"description": "Planetarium showing up to 500 stars using the watch location and time",
|
||||
"tags": "",
|
||||
"storage": [
|
||||
{"name":"planetarium.app.js","url":"planetarium.app.js"},
|
||||
|
|
|
|||
|
|
@ -0,0 +1,2 @@
|
|||
0.01: New App!
|
||||
0.02: Major speed improvement. Added more stars. Up to 500!
|
||||
|
|
@ -2,10 +2,18 @@
|
|||
|
||||
This planetarium takes your position and time and plots the sky as it is.
|
||||
|
||||
No planets, or moon, only stars. It can show the 350 most brilliant stars in the sky.
|
||||
No planets, or moon, only stars. It can show the 500 most brilliant stars in the sky.
|
||||
|
||||
Plan is to show also constellations, but this is work in progress. Now it shows Taurus and Orion as examples.
|
||||
|
||||
I think code is quite optimized already. It runs as fast as I could make it run. If someone has some ideas to speed it up, I could plot more stars.
|
||||
|
||||
Basic equations to compute declination and right ascension for stars where taken from this [github repo](https://github.com/Michi83/planetarium).
|
||||
Basic equations to compute declination and right ascension for stars where taken from this [github repo](https://github.com/Michi83/planetarium). Thanks!
|
||||
|
||||
## How to use
|
||||
The planetarium plots the stars as if you are looking to the sky (with your watch screen pointing downwards). This means, if you have the watch in your wrist, you have to look south to see the stars matching. If you want to look north, just take out the watch from your wrist and make a 180º turn.
|
||||
|
||||
## Improvements
|
||||
I plan to add more constellations as soon as I have time. I am adding the constellations that I know of, but the plan is to add all the main ones (at least for North Hemisphere).
|
||||
|
||||
Please note that the watch hardware is limited and computing the stars positions is a quite intensive task for this little processor. This is why it plots only stars and no planets or the moon. For plotting the planets, storage will be a limiting factor as well as computing the position for planets needs more initial data compared with stars.
|
||||
|
|
@ -46,7 +46,6 @@ function drawStars(lat,lon,date){
|
|||
|
||||
storage = require('Storage');
|
||||
f=storage.read("planetarium.data.csv","r");
|
||||
linestart=0;
|
||||
g.clear();
|
||||
|
||||
//Common calculations based only on time
|
||||
|
|
@ -59,48 +58,62 @@ function drawStars(lat,lon,date){
|
|||
let starNumber = 0;
|
||||
var starPositions = {};
|
||||
|
||||
for (i=0;i<f.length;i++)
|
||||
{
|
||||
if (f[i]=='\n'){
|
||||
starNumber++;
|
||||
//console.log("Line from "+linestart.toString()+"to "+(i-1).toString());
|
||||
line = f.substr(linestart,i-linestart);
|
||||
//console.log(line);
|
||||
linestart = i+1;
|
||||
//Process the star
|
||||
starInfo = line.split(',');
|
||||
//console.log(starInfo[0]);
|
||||
starRA = parseFloat(starInfo[0]);
|
||||
starDE = parseFloat(starInfo[1]);
|
||||
starMag = parseFloat(starInfo[2]);
|
||||
//var start = new Date().getTime();
|
||||
var dec = Math.asin(Math.sin(theta) * Math.cos(starDE) * Math.cos(starRA + zeta) + Math.cos(theta) * Math.sin(starDE));
|
||||
var ascen = Math.atan2(Math.cos(starDE) * Math.sin(starRA + zeta), Math.cos(theta) * Math.cos(starDE) * Math.cos(starRA + zeta) - Math.sin(theta) * Math.sin(starDE)) + z;
|
||||
var H = siderealTime(julianDay) - longitude - ascen;
|
||||
//Compute altitude
|
||||
var alt = Math.asin(Math.sin(latitude) * Math.sin(dec) + Math.cos(latitude) * Math.cos(dec) * Math.cos(H));
|
||||
if(alt >= 0)
|
||||
{
|
||||
//Compute azimuth
|
||||
var azi = Math.atan2(Math.sin(H), Math.cos(H) * Math.sin(latitude) - Math.tan(dec) * Math.cos(latitude));
|
||||
var x = size / 2 + size / 2 * Math.cos(alt) * Math.sin(azi);
|
||||
var y = size / 2 + size / 2 * Math.cos(alt) * Math.cos(azi);
|
||||
starPositions[starNumber] = [x,y];
|
||||
var magnitude = starMag<1.5?2:1;
|
||||
g.fillCircle(x, y, magnitude);
|
||||
if (starMag<1 && settings.starnames)
|
||||
g.drawString(starInfo[3],x,y+2);
|
||||
g.flip();
|
||||
var line,linestart = 0;
|
||||
lineend = f.indexOf("\n");
|
||||
while (lineend>=0) {
|
||||
line = f.substring(linestart,lineend);
|
||||
starNumber++;
|
||||
//console.log(line);
|
||||
//Process the star
|
||||
starInfo = line.split(',');
|
||||
//console.log(starInfo[0]);
|
||||
starRA = parseFloat(starInfo[0]);
|
||||
starDE = parseFloat(starInfo[1]);
|
||||
starMag = parseFloat(starInfo[2]);
|
||||
//var start = new Date().getTime();
|
||||
var dec = Math.asin(Math.sin(theta) * Math.cos(starDE) * Math.cos(starRA + zeta) + Math.cos(theta) * Math.sin(starDE));
|
||||
var ascen = Math.atan2(Math.cos(starDE) * Math.sin(starRA + zeta), Math.cos(theta) * Math.cos(starDE) * Math.cos(starRA + zeta) - Math.sin(theta) * Math.sin(starDE)) + z;
|
||||
var H = siderealTime(julianDay) - longitude - ascen;
|
||||
//Compute altitude
|
||||
var alt = Math.asin(Math.sin(latitude) * Math.sin(dec) + Math.cos(latitude) * Math.cos(dec) * Math.cos(H));
|
||||
if(alt >= 0)
|
||||
{
|
||||
//Compute azimuth
|
||||
var azi = Math.atan2(Math.sin(H), Math.cos(H) * Math.sin(latitude) - Math.tan(dec) * Math.cos(latitude));
|
||||
var x = size / 2 + size / 2 * Math.cos(alt) * Math.sin(azi);
|
||||
var y = size / 2 + size / 2 * Math.cos(alt) * Math.cos(azi);
|
||||
starPositions[starNumber] = [x,y];
|
||||
var magnitude = starMag<1?2:1;
|
||||
//Stars between 1.5 and 4 magnitude should get a different colour
|
||||
var col=1;
|
||||
if (starMag<=1.5)
|
||||
col=1;
|
||||
else if (starMag>1.5 && starMag<2)
|
||||
col=0.9;
|
||||
else if (starMag>=2 && starMag<3)
|
||||
col=0.7;
|
||||
else if (starMag>=3 && starMag<3.5)
|
||||
col=0.5;
|
||||
else
|
||||
col=0.3;
|
||||
|
||||
g.setColor(col,col,col);
|
||||
g.fillCircle(x, y, magnitude);
|
||||
if (starMag<1 && settings.starnames)
|
||||
g.drawString(starInfo[3],x,y+2);
|
||||
g.flip();
|
||||
|
||||
}
|
||||
}
|
||||
linestart = lineend+1;
|
||||
lineend = f.indexOf("\n",linestart);
|
||||
}
|
||||
|
||||
|
||||
if (settings.constellations){
|
||||
//Each star has a number (the position on the file (line number)). These are the lines
|
||||
//joining each star in the constellations.
|
||||
constelations=[[[7,68],[10,53],[53,56],[28,68],"Orion"],[[13,172],[13,340],[293,340],[29,293],"Taurus"],
|
||||
[[155,8],"Canis Menor"],[[36,81],[87,81],[235,87],[33,235],[33,75],[75,40],"Ursa Major"],[[67,91],[74,67],[91,110],[110,252],"Cassiopeia"],[[23,166],[16,294],[294,44],[166,149],[230,149],[16,23],"Gemini"]];
|
||||
[[155,8],"Canis Menor"],[[36,81],[87,81],[235,87],[33,235],[33,75],[75,40],[36,235],"Ursa Major"],[[67,91],[74,67],[91,110],[110,252],"Cassiopeia"],[[23,166],[16,294],[294,44],[166,149],[230,149],[16,23],"Gemini"],[[88,218],[215,292],[218,292],[245,88],[292,245],[215,218],"Cepheus"],[[150,62],[150,175],[175,35],[403,62],[487,158],[384,487],[384,158],[35,158],[487,403],"Perseus"],[[19,65],[65,90],[65,147],[466,65],[466,189],[147,401],[213,90],"Cygnus"],[[6,42],[168,6],[168,113],[113,29],[104,29],[104,42],"Auriga"],[[1,47],[1,37],[37,22],[22,178],[37,89],"Can Maior"],[[3,118],[118,279],[279,286],[286,180],[180,316],[316,3],"Bootes"]];
|
||||
g.setColor(0,255,0);
|
||||
for (i=0;i<constelations.length;i++)
|
||||
{
|
||||
|
|
@ -119,7 +132,7 @@ function drawStars(lat,lon,date){
|
|||
g.flip();
|
||||
}
|
||||
//Write the name
|
||||
if (constelationShowing)
|
||||
if (constelationShowing && settings.consnames)
|
||||
g.drawString(constelations[i][constelations[i].length-1],positionStar2[0]+10,positionStar2[1]);
|
||||
}
|
||||
}
|
||||
|
|
@ -132,7 +145,7 @@ var prevSats = 0;
|
|||
g.clear();
|
||||
|
||||
var settings = require('Storage').readJSON('planetarium.json',1)||
|
||||
{ starnames:false,constellations:true};
|
||||
{ starnames:false,constellations:true,consnames:false};
|
||||
|
||||
g.setFontAlign(0,0);
|
||||
|
||||
|
|
@ -143,7 +156,8 @@ Bangle.on('GPS',function(gp) {
|
|||
lat = gp.lat;
|
||||
lon = gp.lon;
|
||||
Bangle.setGPSPower(0);
|
||||
drawStars(lat,lon,date);
|
||||
setTimeout(function() {
|
||||
drawStars(lat,lon,new Date());},0);
|
||||
} else {
|
||||
g.setFont("Vector",20);
|
||||
g.drawString("Waiting for position",120,120);
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@
|
|||
1.670,-0.313,2.0,BE CMA
|
||||
2.477,-0.151,2.0,AL HYA
|
||||
0.555,0.409,2.0,AL ARI
|
||||
0.663,1.558,2.0,AL UMI
|
||||
0.663,1.558,2.0,Polaris
|
||||
4.954,-0.459,2.0,SI SGR
|
||||
0.190,-0.314,2.0,BE CET
|
||||
1.487,-0.034,2.0,ZE ORI
|
||||
|
|
@ -340,4 +340,161 @@
|
|||
1.134,0.273,3.6,GA TAU
|
||||
3.323,-0.025,3.6,GA VIR
|
||||
3.684,1.124,3.6,AL DRA
|
||||
5.475,-1.020,3.6,BE IND
|
||||
5.475,-1.020,3.6,BE IND
|
||||
0.161,0.941,3.7,ZE CAS
|
||||
1.462,0.173,3.7,LA ORI
|
||||
4.096,-0.520,3.7,TA LIB
|
||||
4.741,-0.874,3.7,TH ARA
|
||||
6.063,-0.370,3.7,88 AQR
|
||||
2.494,1.101,3.7,23 UMA
|
||||
4.129,0.269,3.7,BE SER
|
||||
2.285,-0.579,3.7,AL PYX
|
||||
3.323,-0.025,3.7,GA VIR
|
||||
4.048,0.508,3.7,BE CRB
|
||||
5.673,-0.291,3.7,GA CAP
|
||||
0.871,-0.380,3.7,TA4 ERI
|
||||
1.271,0.098,3.7,PI4 ORI
|
||||
2.554,-1.091,3.7,_
|
||||
6.096,0.057,3.7,GA PSC
|
||||
0.506,-0.901,3.7,CH ERI
|
||||
0.981,0.421,3.7,17 TAU
|
||||
4.703,0.510,3.7,XI HER
|
||||
1.555,-0.247,3.7,ET LEP
|
||||
3.081,0.834,3.7,CH UMA
|
||||
4.149,0.078,3.7,EP SER
|
||||
5.216,0.112,3.7,BE AQL
|
||||
1.284,0.043,3.7,PI5 ORI
|
||||
1.569,0.947,3.7,DE AUR
|
||||
3.867,0.033,3.7,109 VIR
|
||||
5.519,0.767,3.7,XI CYG
|
||||
5.562,0.664,3.7,TA CYG
|
||||
0.486,-0.180,3.7,ZE CET
|
||||
0.929,-0.165,3.7,EP ERI
|
||||
2.060,-0.708,3.7,_
|
||||
4.744,0.167,3.7,72 OPH
|
||||
0.904,0.170,3.7,XI TAU
|
||||
5.614,-0.391,3.7,ZE CAP
|
||||
5.989,-0.132,3.7,LA AQR
|
||||
1.320,0.717,3.8,ZE AUR
|
||||
2.374,-0.822,3.8,_
|
||||
4.284,0.334,3.8,GA HER
|
||||
4.660,0.047,3.8,GA OPH
|
||||
4.684,0.993,3.8,XI DRA
|
||||
5.887,1.020,3.8,DE CEP
|
||||
0.745,0.976,3.8,ET PER
|
||||
1.147,0.306,3.8,DE1 TAU
|
||||
1.456,-1.091,3.8,BE DOR
|
||||
4.406,-1.030,3.8,ET ARA
|
||||
5.679,-1.351,3.8,NY OCT
|
||||
5.790,0.442,3.8,JO PEG
|
||||
0.983,0.743,3.8,NY PER
|
||||
2.207,-1.154,3.8,BE VOL
|
||||
4.995,-0.379,3.8,OK SGR
|
||||
5.049,0.931,3.8,KA CYG
|
||||
5.409,0.278,3.8,AL DEL
|
||||
5.444,-0.166,3.8,EP AQR
|
||||
5.896,0.878,3.8,AL LAC
|
||||
1.871,-1.230,3.8,GA2 VOL
|
||||
2.851,-1.027,3.8,_
|
||||
1.851,0.359,3.8,ZE GEM
|
||||
1.945,0.485,3.8,JO GEM
|
||||
5.104,0.903,3.8,JO2 CYG
|
||||
5.295,0.816,3.8,31 CYG
|
||||
0.827,0.783,3.8,KA PER
|
||||
2.579,1.030,3.8,YP UMA
|
||||
2.705,0.346,3.8,GA2 LEO
|
||||
4.079,0.184,3.8,DE SER
|
||||
4.079,0.184,3.8,DE SER
|
||||
4.623,0.803,3.8,JO HER
|
||||
1.478,-0.045,3.8,SI ORI
|
||||
1.533,-0.364,3.8,DE LEP
|
||||
2.732,-0.294,3.8,MY HYA
|
||||
1.202,-0.533,3.8,YP2 ERI
|
||||
2.438,0.642,3.8,38 LYN
|
||||
2.740,-1.025,3.8,_
|
||||
4.324,0.035,3.8,LA OPH
|
||||
5.181,0.323,3.8,DE SGE
|
||||
6.185,0.811,3.8,LA AND
|
||||
0.979,0.564,3.8,OK PER
|
||||
2.851,0.597,3.8,46 LMI
|
||||
3.658,-0.735,3.8,PH CEN
|
||||
3.874,-1.380,3.8,AL APS
|
||||
4.745,0.502,3.8,OK HER
|
||||
5.184,1.226,3.8,EP DRA
|
||||
1.172,0.279,43.8,TH1 TAU
|
||||
2.272,-0.814,3.8,_
|
||||
2.335,-1.058,3.8,_
|
||||
2.781,-0.842,3.8,_
|
||||
3.017,1.210,3.8,LA DRA
|
||||
4.113,0.459,3.8,GA CRB
|
||||
4.816,0.380,3.8,109 HER
|
||||
5.854,-0.024,3.8,GA AQR
|
||||
0.978,-1.131,3.8,BE RET
|
||||
1.515,-0.891,3.8,BE PIC
|
||||
1.667,-0.584,3.8,DE COL
|
||||
1.897,-0.467,3.8,OM CMA
|
||||
2.682,-0.735,3.8,_
|
||||
2.761,0.162,3.8,RH LEO
|
||||
4.173,0.273,3.8,GA SER
|
||||
4.256,-1.112,3.8,DE TRA
|
||||
4.866,-0.144,3.8,AL SCT
|
||||
1.108,-0.738,3.9,AL HOR
|
||||
3.306,-0.847,3.9,TA CEN
|
||||
4.696,0.650,3.9,TH HER
|
||||
4.772,-0.368,3.9,MY SGR
|
||||
0.248,0.672,3.9,MY AND
|
||||
0.838,-0.506,3.9,AL FOR
|
||||
0.985,0.425,3.9,20 TAU
|
||||
1.214,-0.250,3.9,53 ERI
|
||||
1.445,-0.619,3.9,EP COL
|
||||
1.807,-0.422,3.9,OK1 CMA
|
||||
3.283,-1.259,3.9,GA MUS
|
||||
3.288,1.218,3.9,KA DRA
|
||||
3.659,-0.782,3.9,YP1 CEN
|
||||
3.979,-0.851,3.9,KA1 LUP
|
||||
0.041,-0.798,3.9,EP PHE
|
||||
2.419,0.040,3.9,TH HYA
|
||||
2.586,0.454,3.9,MY LEO
|
||||
3.539,-0.688,3.9,_
|
||||
3.853,-0.099,3.9,MY VIR
|
||||
4.175,-0.510,3.9,RH SCO
|
||||
0.770,-0.155,3.9,ET ERI
|
||||
2.971,-0.951,3.9,PI CEN
|
||||
3.228,-0.012,3.9,ET VIR
|
||||
4.275,0.808,3.9,TA HER
|
||||
4.335,-1.377,3.9,GA APS
|
||||
5.220,0.612,3.9,ET CYG
|
||||
2.206,-0.068,3.9,_
|
||||
5.203,0.018,3.9,ET AQL
|
||||
6.067,-0.790,3.9,JO GRU
|
||||
1.061,0.105,3.9,NY TAU
|
||||
2.295,-0.804,3.9,_
|
||||
2.530,-0.020,3.9,JO HYA
|
||||
2.917,-1.029,3.9,_
|
||||
3.264,-0.877,3.9,SI CEN
|
||||
4.082,-0.258,3.9,GA LIB
|
||||
0.298,-0.964,3.9,ZE PHE
|
||||
4.452,0.540,3.9,EP HER
|
||||
5.567,0.092,3.9,AL EQU
|
||||
1.206,-0.059,3.9,NY ERI
|
||||
2.013,-0.167,3.9,AL MON
|
||||
5.069,-0.311,3.9,RH1 SGR
|
||||
0.114,-0.762,3.9,KA PHE
|
||||
2.289,0.317,3.9,DE CNC
|
||||
2.984,0.184,3.9,JO LEO
|
||||
5.485,0.719,3.9,NY CYG
|
||||
0.398,-0.856,4.0,DE PHE
|
||||
0.760,0.921,4.0,TA PER
|
||||
1.731,-0.336,4.0,NY2 CMA
|
||||
2.015,-1.267,4.0,ZE VOL
|
||||
3.508,0.959,4.0,ZE UMA
|
||||
4.149,-0.587,4.0,CH LUP
|
||||
5.963,0.411,4.0,LA PEG
|
||||
1.152,-0.594,4.0,43 ERI
|
||||
1.567,-0.747,4.0,ET COL
|
||||
1.788,-0.567,4.0,KA CMA
|
||||
2.024,-0.505,4.0,3 PUP
|
||||
3.192,-0.914,4.0,RH CEN
|
||||
4.218,-0.361,4.0,OM1 SCO
|
||||
5.239,-1.273,4.0,EP PAV
|
||||
1.534,0.683,4.0,NY AUR
|
||||
|
|
|
@ -19,7 +19,13 @@
|
|||
format: v =>v?'On':'Off',
|
||||
onchange: v => {
|
||||
save('constellations',v);
|
||||
}
|
||||
}};
|
||||
}},
|
||||
'Const. names': {
|
||||
value: !!settings.consnames,
|
||||
format: v =>v?'On':'Off',
|
||||
onchange: v => {
|
||||
save('consnames',v);
|
||||
}},
|
||||
};
|
||||
E.showMenu(appMenu)
|
||||
})
|
||||
Loading…
Reference in New Issue