コード例 #1
0
ファイル: ft_set_width.c プロジェクト: mlevieux/Save
char		*ft_set_width(char *result, T_LIST *trail)
{
	int		i;
	char	*insert;

	i = 0;
	set_i(&i, result, trail);
	if ((trail->format == 'p' && trail->z_pad && !trail->minus) ||
			((trail->format == 'x' || trail->format == 'X') &&
			trail->alternate && trail->z_pad))
		i = 2;
	if (trail->width > (int)ft_strlen(result))
	{
		if (!(trail->minus))
			result = trail_minus(result, trail, i);
		else
		{
			insert = ft_strset(ft_strnew(trail->width - ft_strlen(result)),
						trail->width - ft_strlen(result), ' ');
			result = ft_repstr(result, ft_strlen(result), ft_strlen(result),
					insert);
			free(insert);
		}
	}
	return (result);
}
コード例 #2
0
ファイル: kspluto.cpp プロジェクト: Bugsbane/kstars
//Determine values for the orbital elements for the requested JD, then
//call KSAsteroid::findGeocentricPosition()
bool KSPluto::findGeocentricPosition( const KSNumbers *num, const KSPlanetBase *Earth ) {
    //First, set the orbital element values according to the current epoch
    double t = num->julianCenturies();
    set_a( a0 + a1*t );
    set_e( e0 + e1*t );
    set_i( i0.Degrees() + i1*t );
    set_N( N0.Degrees() + N1*t );
    set_M( M0.Degrees() + M1*t );
    set_P( 365.2568984 * pow((a0+a1*t), 1.5) ); //set period from Kepler's 3rd law
    setJD( num->julianDay() );

    return KSAsteroid::findGeocentricPosition( num, Earth );
}
コード例 #3
0
ファイル: lca_base.hpp プロジェクト: aicro/patl
 void setup_i(Oracle *oracl)
 {
     vertex vtx(oracl->new_algo(this));
     vtx.iterate(0);
     this_t
         *ltI = oracl->get_by(vtx)->get_i(),
         *rtI = (oracl->get_by(vtx) + 1)->get_i();
     const word_t
         idH = height(),
         ltH = ltI->height(),
         rtH = rtI->height();
     if (idH > ltH && idH > rtH)
         set_inode();
     else if (ltH < rtH)
     {
         set_i(rtI);
         rtI->set_l(this);
     }
     else
     {
         set_i(ltI);
         ltI->set_l(this);
     }
 }