write a code for bresenham line drawing algorithm in processing.org
static void bresenham(int num, int num2, int R, int R2)
{
int new1 = 2 * (R2 - num2);
int SError = new1 - (R - num);
for (int x = num, y = num2; x <= R; x++)
{
System.out.print("(" +x + "," + y + ")\n");
SError += new1;
if (SError >= 0)
{
y++;
SError -= 2 * (R - num);
}
}
}
Comments
Leave a comment