salut sasume,
oui je calcul en float car c'est un logiciel d'astronomie (ephemeride et pilotage de telesctope) j'ai don besoin d'une grande precision.
Pour utiliser les virgules fixes, est-ce possible UNIQUEMENT dans une fonction ?
sinon voici le tracage des meridiens :
void DrawSphere(unsigned short x, unsigned short y, unsigned short r, float phase, float angle)
{
float xa = 0.0,
ya = 0.0,
za = 0.0;
unsigned int xs = 0,
xx = 0,
ys = 0,
yy = 0;
float a = 0.0,
b = 0.0,
j = 0.0,
i = 0.0;
for( a=-PI/2.0 ; a<=PI/2.0 ; a+=0.2)
{
if(phase>PI)
{
b=phase-PI; //Deg2Rad(Norm180(Rad2Deg(phase-PI)));
j=PI;
}
else
{
b=0.0;
j=phase;
}
xa = r*(cos(a)*cos(b));
ya = r*(cos(a)*sin(b));
za = r*sin(a);
xs = ((unsigned int)Int_Float(xa+ya*(angle)));
ys = (unsigned int)Int_Float(za+ya*(angle));
xx = xs+x;
yy = ys+y;
while(b<=j)
{
xa = r*(cos(a)*cos(b));
ya = r*(cos(a)*sin(b));
za = r*sin(a);
xs = ((unsigned int)Int_Float(xa+ya*(angle)))+x;
ys = (unsigned int)Int_Float(za+ya*(angle))+y;
DrawLine(xx, yy, xs, ys, A_NORMAL);
xx = xs;
yy = ys;
b+=0.2;
}
}
if(phase<PI)
{
b=0.0;
i=phase;
}
else
{
b=phase-PI;
i=PI;
}
while( b<=i )
{
if(phase<0)
{
a=phase-PI;
j=PI;
}
else
{
a=-PI/2.0;
j=PI/2.0;
}
xa = r*(cos(a)*cos(b));
ya = r*(cos(a)*sin(b));
za = r*sin(a);
xs = ((unsigned int)Int_Float(xa+ya*(angle)));
ys = (unsigned int)Int_Float(za+ya*(angle));
xx = xs+x;
yy = ys+y;
while(a<=j)
{
xa = r*(cos(a)*cos(b));
ya = r*(cos(a)*sin(b));
za = r*sin(a);
xs = ((unsigned int)Int_Float(xa+ya*(angle)))+x;
ys = (unsigned int)Int_Float(za+ya*(angle))+y;
DrawLine(xx, yy, xs, ys, A_NORMAL);
xx = xs;
yy = ys;
a+=0.2;
}
b+=0.2;
}
}
mais c'est encore plus GROS...
ExtGraph est sans doute tres bien, mais je ne crois pas approprie pour mon prog

dommage.
je pensais plutot a une petite routine "maison"...
bon j'y retourne
A+