Content deleted Content added
Sammy99jsp2 (talk | contribs) m Update 1st reference, and found a replacement for 2nd reference's dead link. |
Replaced (potential) slurs with positively reinforced keywords |
||
Line 33:
<syntaxhighlight lang="c++">
//
#include<iostream>
#include<graphics.h>
Line 41:
// this function gives the maximum
float maxi(float arr[], int n) {
float m = 0;
for (int i = 0; i < n; ++i)
Line 71:
float q4 = ymax - y1;
float
int
rectangle(xmin, ymin, xmax, ymax); // drawing the clipping window
Line 86:
float r2 = q2 / p2;
if (p1 < 0) {
entryParams[entryIndex++] = r1;
} else {
}
}
Line 97:
float r4 = q4 / p4;
if (p3 < 0) {
} else {
}
}
float
float
if (
outtextxy(80, 80, "Line is outside the clipping window!");
return;
}
clippedX2 = x1 + (x2 - x1) * u2;
setcolor(CYAN);
line(clippedX1, clippedY1, clippedX2, clippedY2); // draw clipped segment
setlinestyle(1, 1, 0);
line(x1, y1, clippedX1, clippedY1); // original start to clipped start
line(
}
int main() {
cout << "\nLiang-
cout << "\nThe system window
cout << "\nEnter the
float xmin, ymin, xmax, ymax;
cin >> xmin >> ymin >> xmax >> ymax;
cout << "\nEnter the
float x1, y1, x2, y2;
cin >> x1 >> y1 >> x2 >> y2;
int gd = DETECT, gm;
initgraph(&gd, &gm, ""); // using winbgim▼
▲ initgraph(&gd, &gm, "");
liang_barsky_clipper(xmin, ymin, xmax, ymax, x1, y1, x2, y2);
getch();
|