function drawStar(zeta,theta,z,julianDay,latitude,longitude,starInfo,starNumber,starPositions){
  let starRA = parseFloat(starInfo[0]);
  let starDE = parseFloat(starInfo[1]);
  let starMag = parseFloat(starInfo[2]);
  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();

  }
}
/*
* Draws a single star in the sky. 
* starPositions is a dictionary that gets modified and it is used later for ploting the constelations
*/
Draws a single star in the sky.
starPositions is a dictionary that gets modified and it is used later for ploting the constelations
Draws a single star in the sky . starPositions is a dictionary that gets modified and it is used later for ploting the constelations
function drawStar(zeta,theta,z,julianDay,latitude,longitude,starInfo,starNumber,starPositions){
  let starRA = parseFloat(starInfo[0]);
  let starDE = parseFloat(starInfo[1]);
  let starMag = parseFloat(starInfo[2]);
  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;
  var alt = Math.asin(Math.sin(latitude) * Math.sin(dec) + Math.cos(latitude) * Math.cos(dec) * Math.cos(H));
  if(alt >= 0)
  {
    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;
    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();
  }
}
function drawStar ( zeta , theta , z , julianDay , latitude , longitude , starInfo , starNumber , starPositions ) { let starRA = parseFloat ( starInfo [ 0 ] ) ; let starDE = parseFloat ( starInfo [ 1 ] ) ; let starMag = parseFloat ( starInfo [ 2 ] ) ; 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 ; var alt = Math . asin ( Math . sin ( latitude ) * Math . sin ( dec ) + Math . cos ( latitude ) * Math . cos ( dec ) * Math . cos ( H ) ) ; if ( alt >= 0 ) { 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 ; 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 ( ) ; } }
Draws a single star in the sky.
Draws a single star in the sky .
//Compute altitude //Compute azimuth   //Stars between 1.5 and 4 magnitude should get a different colour