コード例 #1
0
ファイル: modelmain.cpp プロジェクト: tipe/vcc
void ModelMain::load_time_control(TimeControl &target)
{
	const ptree &node(fetch("time-control"));
	target.set_mode(node.get("mode", TimeControl::Mode::SUDDEN_DEATH));
	for(auto s = Enum::cursor<Side>::first(); s.valid(); ++s) {
		target.set_main_time  (*s, node.get(side_key(*s, "main-time"  ), from_seconds(3*60)));
		target.set_increment  (*s, node.get(side_key(*s, "increment"  ), from_seconds(   2)));
		target.set_byo_periods(*s, node.get(side_key(*s, "byo-periods"), 1));
	}
}
コード例 #2
0
ファイル: angles.c プロジェクト: BlastTNG/flight
void horizontal_to_equatorial(double az_deg, double el_deg, time_t lst_s, double lat_deg,
                              double* ra_hours, double* dec_deg)
{
    double ha = 0.0;
    double dec = 0.0;

    double sa, ca, se, ce, sp, cp, x, y, z, r;

    sincos(from_degrees(az_deg), &sa, &ca);
    sincos(from_degrees(el_deg), &se, &ce);
    sincos(from_degrees(lat_deg), &sp, &cp);

    /* HA,Dec as x,y,z */
    x = -ca * ce * sp + se * cp;
    y = -sa * ce;
    z = ca * ce * cp + se * sp;

    /* To spherical */
    r = sqrt(x * x + y * y);
    ha = (r == 0.0) ? 0.0 : atan2(y, x);
    dec = atan2(z, r);

    *ra_hours = to_hours(from_seconds(lst_s) - ha);
    *ra_hours = wrap_to(*ra_hours, 24.0);
    *dec_deg = to_degrees(dec);
}
コード例 #3
0
ファイル: angles.c プロジェクト: BlastTNG/flight
void equatorial_to_horizontal(double ra_hours, double dec_deg, time_t lst_s, double lat_deg,
                              double* az_deg, double* el_deg)
{
    double ha = from_seconds(lst_s) - from_hours(ra_hours);

    double sh, ch, sd, cd, sp, cp, x, y, z, r, a;

    sincos(ha, &sh, &ch);
    sincos(from_degrees(dec_deg), &sd, &cd);
    sincos(from_degrees(lat_deg), &sp, &cp);

    /* Az,El as x,y,z */
    x = -ch * cd * sp + sd * cp;
    y = -sh * cd;
    z = ch * cd * cp + sd * sp;

    /* To spherical */
    r = sqrt(x * x + y * y);
    a = (fabs(r) < DBL_MIN) ? 0.0 : atan2(y, x);

    *az_deg = to_degrees((a < 0.0) ? a + (2.0 * M_PI) : a);
    *el_deg = to_degrees(atan2(z, r));
}
コード例 #4
0
ファイル: modelmain.cpp プロジェクト: tipe/vcc
void ModelMain::load_delay_before_display_seconds(TimeDuration &target)
{
	target = _root->get("time-options.delay-for-seconds", from_seconds(20*60));
}