Skip to content

Commit 21fcae6

Browse files
lol
1 parent 23f874b commit 21fcae6

File tree

12 files changed

+151928
-196
lines changed

12 files changed

+151928
-196
lines changed

GraphicsLab_Bressenham/GraphicsLab_Bressenham.pde

+24
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,30 @@ void plotLineHigh(int x0, int y0, int x1, int y1) {
4848
}
4949

5050
void plotLine(int x0, int y0, int x1, int y1) {
51+
52+
int a0=x0, a1=x1, b0=y0, b1=y1;
53+
if (x0 == x1) {
54+
if (y0>y1) {
55+
b0 = y1;
56+
b1 = y0;
57+
}
58+
for (int i=b0; i<b1; i++) {
59+
plotPixel(x0, i);
60+
}
61+
return;
62+
}
63+
64+
if (y0 == y1) {
65+
if (x0>x1) {
66+
a0 = x1;
67+
a1 = x0;
68+
}
69+
for (int i=a0; i<a1; i++) {
70+
plotPixel(i, y0);
71+
}
72+
return;
73+
}
74+
5175
if (abs(y1-y0)<abs(x1-x0)) {
5276
if (x0>x1) {
5377
plotLineLow(x1, y1, x0, y0);

GraphicsLab_Clipping/GraphicsLab_LineClipping.pde

-117
This file was deleted.

0 commit comments

Comments
 (0)