Exemplo n.º 1
0
void main()
{
	long double l, jdn;
	time_t cl;
	struct tm *to;
	int i = 0;

	time(&cl);
	to = localtime(&cl);

	l = JD(to->tm_year + 1900, to->tm_mon + 1, to->tm_mday - 1, to->tm_hour, to->tm_min, to->tm_sec, 0, 135);

	jdn = MoonPhaseGet(l);

	if (45 < jdn && jdn < 135) i = 90;
	else if (135 < jdn && jdn < 225) i = 180;
	else if (225 < jdn && jdn < 315) i = 270;

	YMDHMS(MoonPhaseNext(l, i), 135);
	ObservationPointSet(35.919084, 140.125637, 0); //茨城県取手市
	YMDHMS(MoonPhaseNext(l, i), 135);
	ObservationPointSet(35.986293, 139.374023, 0); //埼玉県鳩山町
	YMDHMS(MoonPhaseNext(l, i), 135);
	ObservationPointSet(35.958312, 139.854069, 0); //千葉県野田市
	YMDHMS(MoonPhaseNext(l, i), 135);
	ObservationPointSet(35.729304, 139.710217, 0); //東京都豊島区
	YMDHMS(MoonPhaseNext(l, i), 135);
	exit(0);
}
Exemplo n.º 2
0
void DessinPerso()
{
	/* Parametrage du placage de textures */
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
	glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 256, 256, 0,
		GL_RGB, GL_UNSIGNED_BYTE, poil);
	glEnable(GL_TEXTURE_2D);

	glTranslatef(0, 0.5 + time + ta, 0);
	glRotated(a, 1, 0, 0);
	glTranslatef(0, -0.5 - time - ta, 0);
	
	Tete();
	Socle();
	Ponpon();
	Nez();
	Oeil(1);
	Oeil(-1);
	Corps();
	BrasG();
	BrasD();
	JG();
	JD();
	//Aile Droite (DG=1)
	Aile(1);
	//Aile Gauche (DG=(-1)
	Aile(-1);
}
Exemplo n.º 3
0
  void testJd()
  {
    struct tm j2kish; // Noon Jan 1, 2000, GMT
    memset(&j2kish, '\0', sizeof(struct tm));
    j2kish.tm_year = 100; // y2k
    j2kish.tm_hour = 12;
    j2kish.tm_mday = 1;
    time_t j2ktt = timegm(&j2kish);
    JD j2kjd = JD(j2ktt);

    CPPUNIT_ASSERT(j2kjd.getJdn() == 2451545);
    CPPUNIT_ASSERT(j2kjd.getJd() == 2451545.0);

    struct tm todayish;
    memset(&todayish, '\0', sizeof(struct tm));
    todayish.tm_year = 111; // 2011
    todayish.tm_mday = 5;
    todayish.tm_mon = 10; // November (UNIX months start at 0)
    todayish.tm_hour = 10;
    todayish.tm_min = 27;
    todayish.tm_sec = 23;
    time_t todaytt = timegm(&todayish);
    JD todayjd(todaytt);

    double jdDiff = fabs(todayjd.getJd() - 2455870.935683);

    CPPUNIT_ASSERT(todayjd.getJdn() == 2455871);
    CPPUNIT_ASSERT(jdDiff < .000001);
    
  }
Exemplo n.º 4
0
JSDDateTime::JSDDateTime(MJDDateTime& rhs)
{
  CivilDateTime referenceCiv;

  /* Initialisation of the MJD reference day (01/01/2000, 0h00) */
  referenceCiv.set_year(2000);
  referenceCiv.set_month(01);
  referenceCiv.set_day(01);
  referenceCiv.set_second(0);
  referenceCiv.set_decimal(0.0);

  /* JSD day of the ref. MJD date */
  JSDDateTime referenceJSD(referenceCiv);

  /* JSD day computation */
  JulianDate JD((double) rhs.get_day());

  _day0hTU = referenceJSD.get_day0hTU() + JD;
  _second  = referenceJSD.get_second()  + (double) rhs.get_second();
  _decimal = referenceJSD.get_decimal() + 0.000001 * (double) rhs.get_microsecond();

  this->NormDate();
}
Exemplo n.º 5
0
//标准历转换成格里历
int  No2Gr(int y,int m,int d)
{
    return floor((float)(revJD(JD(y,m,d,12,0,0,0,1),0,2)/1000000));
}
Exemplo n.º 6
0
//格里历转换成标准历
int  Gr2No(int y,int m,int d)
{
    return floor((float)(revJD(JD(y,m,d,12,0,0,0,2),0,1)/1000000));
}
Exemplo n.º 7
0
Arquivo: astro.c Projeto: actility/ong
void astro_calculate(astro_t *ast) {
	if	(!ast->tm) {
		time_t t = time(0);
		ast->tm	= localtime(&t);
	}
/*
	if	(!ast->Lat && !ast->Lon) {
		ast->Lat	= 45.7500000000;
		ast->Lon	= 4.8333333333;
	}
*/

/*
	ast->j = ast->tm->tm_yday;
*/
	ast->JD = JD (ast->tm->tm_year+1900, ast->tm->tm_mon+1, ast->tm->tm_mday + 0.5);	// 0.5 is 12:00
	ast->j = ast->JD - 2451545.0;	// 2000.0

#if (VERSION==1)
	ast->M = 357 + 0.9856 * ast->j;
	ast->C = 1.914 * sind(ast->M) + 0.02 * sind(2*ast->M);
	ast->L = 280 + ast->C + 0.9856 * ast->j;
	ast->R = -2.465 * sind(2*ast->L) + 0.053 * sind(4*ast->L);
#endif
#if (VERSION==2)
	ast->M = 357.5291 + 0.98560028 * ast->j;
	ast->C = 1.9146 * sind(ast->M) + 0.02 * sind(2*ast->M) + 0.0003 * sind(3*ast->M);
	ast->L = 280.4665 + ast->C + 0.98564736 * ast->j;
	ast->R = -2.4680 * sind(2*ast->L) + 0.053 * sind(4*ast->L) - 0.0014 * sind(6*ast->L);
#endif

	ast->EoT = -(ast->C + ast->R) * 4;

	//	0.397777 représente le sinus de l'obliquité de l'écliptique (23.43929)
	ast->Dec = asind(0.397777 * sind(ast->L));

	//double RA = atan2d(0.9175*sind(ast->L), cosd(ast->L));

	/*
	Le Soleil se lève ou se couche quand le bord supérieur de son disque apparaît ou disparait à l'horizon.
	Du fait de la réfraction atmosphérique le centre du Soleil est alors à 50' sous l'horizon : 34' pour
	l'effet de la réfraction et 16' pour le demi-diamètre du Soleil. L'angle horaire Ho du Soleil, en degrés,
	au moment où son bord supérieur est sur l'horizon est donné par :
	*/
#define UPPER_LIMB -0.01454		// sind(50/60);
#define BUREAU_DES_LONGITUDES -0.01065	// sind(36.6/60);
#define CREPUSCULE_CIVIL -0.105
#define CREPUSCULE_NAUTIQUE -0.208
#define CREPUSCULE_ASTRONOMIQUE -0.309

	/*
	Si vous comparez aux valeurs données par le Bureau des Longitudes (IMCCE) vous constaterez qu'elles sont franchement différentes. En effet le BdL calcule les heures des lever/coucher du centre du Soleil avec une réfraction à l'horizon de 36,6'. Pour vous assurer de la justesse de vos calculs remplacez 0,01454 par 0,01065 dans l'expression de Ho.
	*/

#define Occultation UPPER_LIMB
//#define Occultation BUREAU_DES_LONGITUDES

	ast->cosHo = (Occultation - sind(ast->Dec)*sind(ast->Lat)) / (cosd(ast->Dec)*cosd(ast->Lat));

	/* Si la valeur du cosinus est supérieure à 1 il n'y a pas de lever (et pas de coucher), le Soleil est
	toujours sous l'horizon; si elle est inférieure à -1 il n'y a pas de coucher (et pas de lever), le
	Soleil est toujours au dessus de l'horizon.
	*/

	if	(ast->cosHo < -1) {
		ast->DayTime	= 1;
		return;
	}
	if	(ast->cosHo > 1) {
		ast->DayTime	= 0;
		return;
	}

	ast->Ho = acosd(ast->cosHo);

	//	Azimut
	//ast->cosAz = ( X * sind(ast->Lat) - sind(ast->Dec)) / cosd(ast->Lat);
	//ast->Az = acos(ast->cosAz);

	//	Lever
	ast->VL = 12 - ast->Ho/15;		// Heure vraie
	ast->TL = ast->VL - ast->EoT/60 - ast->Lon/15; // Heure UTC
	ast->HL = ast->TL + ast->tm->tm_gmtoff/3600; // Heure légale

	//	Coucher
	ast->VC = 12 + ast->Ho/15;	// Heure vraie;
	ast->TC = ast->VC - ast->EoT/60 - ast->Lon/15; // Heure UTC
	ast->HC = ast->TC + ast->tm->tm_gmtoff/3600; // Heure légale

	//	Epoch calculation
	struct tm tm	= *ast->tm;
	tm.tm_hour = tm.tm_min = tm.tm_sec = 0;
	time_t hour0	= mktime(&tm);
	hour0	+= tm.tm_gmtoff;
	ast->TL_epoch	= hour0 + ast->TL*3600;
	ast->TC_epoch	= hour0 + ast->TC*3600;

	ast->h = (double)ast->tm->tm_hour + (double)ast->tm->tm_min/60.0 + (double)ast->tm->tm_sec/3600.0;

	if	((ast->h > ast->HL) && (ast->h < ast->HC)) {
		ast->DayTime	= 1;
		return;
	}
	else {
		ast->DayTime	= 0;
		return;
	}
}