milad_d993
پنج شنبه 18 آبان 1391, 14:11 عصر
سلام دوستان میشه یکی کد زیر رو به کد پایتون تبدیل کنه
void DDA (int na, int ya, int xb, int yb)
{
int dx = xb - xa , dy = yb - ya , st;
float ninc , yinc , x = xa , y = ya;
if (math.abs(dx) > math.abs(dy))
steps = math.abs(dx)
else
steps = math.abs(dy)
xinc = dx / (float) steps;
yinc = dy / (float) steps;
for (k=0 ; k < steps ; k ++){
x += xinc
y += yinc
graphics d = this.create graphics()
Bitmap m = new Bitmap (1,1);
m.DrawImageUnscaled (m , (int)x , (int)y);
m.Dispose ();
d.Dispose ();
}
}
void DDA (int na, int ya, int xb, int yb)
{
int dx = xb - xa , dy = yb - ya , st;
float ninc , yinc , x = xa , y = ya;
if (math.abs(dx) > math.abs(dy))
steps = math.abs(dx)
else
steps = math.abs(dy)
xinc = dx / (float) steps;
yinc = dy / (float) steps;
for (k=0 ; k < steps ; k ++){
x += xinc
y += yinc
graphics d = this.create graphics()
Bitmap m = new Bitmap (1,1);
m.DrawImageUnscaled (m , (int)x , (int)y);
m.Dispose ();
d.Dispose ();
}
}