Bresenham,Elipse En c#
private int BRESENHAM2(int Bx1, int By1, int Bx2, int By2,Point t)
{
float e, ax, ay, temp;
int s1, s2,intercambio, i, x, y;
//Pen penaux = new Pen(penA);
//penaux.Width = gros;
//penaux.Width = 6;
x = Bx1;
int ret = 0;
y =By1;
ax = Math.Abs(Bx2 - Bx1);
ay = Math.Abs(By2 - By1);
s1 = signo(Bx2 - Bx1);
s2 = signo(By2 - By1);
if (ay > ax)
{temp = ax;
ax = ay;
ay = temp;
intercambio = 1;
}
else
{
intercambio = 0;}
e = 2 * ay - ax;
for (i = 1; i = 0)
{
if (intercambio == 1)
{
x = x + s1;}
else
{
y = y + s2;
}
e = e - (2 * ax);
}if (intercambio == 1)
{
y = y + s2;
}
else
{
x = x + s1;
}e = e + 2 * ay;
}
return ret;
}
public void Elipse(int xc, int yc, int rx, int ry,Pen penA,int gros,int style)
{
int x, y, p, px, py;int rx2, ry2, tworx2, twory2;
ry2 = ry * ry;
rx2 = rx * rx;
twory2 = 2 * ry2;
tworx2 = 2 * rx2;
/* región 1 */
x= 0;
y = ry;
Points2(xc,yc,x, y,penA,gros);
p = (int)Math.Round(ry2 - rx2 * ry + .25 * rx2);
//.25
px = 0;
py = tworx2...
Regístrate para leer el documento completo.