-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgasket.c
More file actions
41 lines (32 loc) · 745 Bytes
/
Copy pathgasket.c
File metadata and controls
41 lines (32 loc) · 745 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include <stdio.h>
#include <graphics.h>
void gasket(int x1,int y1,int x2,int y2,int x3,int y3)
{
int x4,x5,x6,y4,y5,y6;
if((x1-x2)>1)
{
x4=(x1+x2)/2;
x5=(x1+x3)/2;
x6=(x3+x2)/2;
y4=(y1+y2)/2;
y5=(y1+y3)/2;
y6=(y3+y2)/2;
line(x4, y4, x5, y5);
line(x4, y4, x6, y6);
line(x5, y5, x6, y6);
gasket(x1,y1,x4,y4,x5,y5);
gasket(x4,y4,x2,y2,x6,y6);
gasket(x5,y5,x6,y6,x3,y3);
}
}
int main()
{
int gd = DETECT, gm = 0, len;
initgraph(&gd,&gm,NULL);
line(300, 100, 200, 200);
line(300, 100, 400, 200);
line(200, 200, 400, 200);
gasket(300,100,200,200,400,200);
getch();
closegraph();
}