-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathdome.c
106 lines (77 loc) · 1.6 KB
/
dome.c
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
/* dome --- plot net for geodesic dome 1996-12-15 */
/* Copyright (c) 1996 John Honniball */
#include <stdio.h>
#include "turtle.h"
void hexa(const double len);
void penta(const double len);
int main(int argc, char * const argv[])
{
int i;
const double size = 32.0; /* 32mm sides */
turtle(DEV_HPGL, SIZ_A3, ORI_LAND, FLG_BORD);
pen(UP);
turn(90.0);
forward(size + 5.0);
turn(-90.0);
pen(DOWN);
colour(BLACK);
for (i = 0; i < 3; i++) {
penta(size);
turn(60.0);
forward(size);
turn(-60.0);
hexa(size);
turn(-60.0);
penta(size);
turn(-60.0);
hexa(size);
turn(-60.0);
forward(size);
turn(60.0);
}
#ifdef DRAW_FOLD_LINES
colour(RED);
for (i = 0; i < 6; i++) { /* Clockwise hexagon in centre */
forward(size);
turn(-60.0);
}
for (i = 0; i < 3; i++) { /* Three half-hexagons for fold lines */
pen(UP);
forward(size);
turn(60.0);
forward(size);
turn(-60.0);
pen(DOWN);
for (j = 0; j < 3; j++) {
forward(size);
turn(-60.0);
}
pen(UP);
forward(size);
turn(60.0);
pen(DOWN);
}
#endif
show();
return (0);
}
void hexa(const double len)
{
int i;
turn(120.0);
for (i = 0; i < 5; i++) {
forward(len);
turn(-60.0);
}
turn(180.0);
}
void penta(const double len)
{
int i;
turn(108.0);
for (i = 0; i < 4; i++) {
forward(len);
turn(-72.0);
}
turn(180.0);
}