This repository has been archived by the owner on Jan 12, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gen_dims.c
236 lines (231 loc) · 4.69 KB
/
gen_dims.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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <sys/stat.h>
#include <fcntl.h>
typedef signed short mesurements[16];
enum mesure_index {mes_skull,mes_neck,mes_shld,mes_back,mes_humr,mes_femr,
mes_pelv,mes_cxyx,mes_tail,mes_wing,mes_q,mes_dig,mes_fan_len,mes_fan_rad,
mes_fan_ang};
mesurements geomet;
float tmp;
FILE * newfile;
char filepath[512];
#define nextline scanf("%*[^\n]s");
#define S_RATIO 2.414213562373095048802
noop () {}
main()
{
puts("file to write: ");
scanf("%s",filepath);
nextline
newfile = fopen(filepath,"wx");
if (newfile != NULL)
{
for (unsigned char n=0;n<15;n++)
{
switch (n)
{
case 0 :
{
printf("head circumfrence\n(cm) ");
scanf("%f",&tmp);
geomet[mes_skull] = (signed short)((tmp / (200 * M_PI)) * 64);
break;
}
case 1 :
{
printf("length of spine (cervical)\n(cm) ");
scanf("%f",&tmp);
geomet[mes_neck] = (signed short)((tmp / 100) * 64);
break;
}
case 2 :
{
printf("shoulder width\n(cm) ");
scanf("%f",&tmp);
geomet[mes_shld] = (signed short)((tmp / 200) * 64);
break;
}
case 3 :
{
printf("length of spine (thorassic, lumbar)\n(cm) ");
scanf("%f",&tmp);
geomet[mes_back] = (signed short)((tmp / 100) * 64);
break;
}
case 4 :
{
printf("humoral length\n(cm) ");
scanf("%f",&tmp);
geomet[mes_humr] = (signed short)((tmp / 100) * 64);
break;
}
case 5 :
{
printf("femoral length\n(cm) ");
scanf("%f",&tmp);
geomet[mes_femr] = (signed short)((tmp / 100) * 64);
break;
}
case 6 :
{
printf("pelvis width\n(cm) ");
scanf("%f",&tmp);
geomet[mes_pelv] = (signed short)((tmp / 200) * 64);
break;
}
case 7 :
{
printf("coxxyx length\n(cm) ");
scanf("%f",&tmp);
geomet[mes_cxyx] = (signed short)((tmp / 100) * 64);
break;
}
case 8 :
{
printf("tail (spinal) length\n(cm) ");
scanf("%f",&tmp);
geomet[mes_tail] = (signed short)((tmp / 100) * 64);
break;
}
case 9 :
{
printf("wingspan (literally)\n(m) ");
scanf("%f",&tmp);
geomet[mes_wing] = (signed short)((tmp / ((4 * S_RATIO) + 2)) * 64);
break;
}
case 10 :
{
printf("\"Q\" angle\n(deg) ");
scanf("%f",&tmp);
geomet[mes_q] = (signed short)(tmp * 64);
break;
}
case 11 :
{
printf("digitigrade angle\n(deg) ");
scanf("%f",&tmp);
geomet[mes_dig] = (signed short)(tmp * 64);
break;
}
case 12 :
{
printf("tail (fan) length\n(cm) ");
scanf("%f",&tmp);
geomet[mes_fan_len] = (signed short)((tmp / 100) * 64);
break;
}
case 13 :
{
printf("tail (fan) width\n(cm) ");
scanf("%f",&tmp);
geomet[mes_fan_rad] = (signed short)((tmp / 100) * 64);
break;
}
case 14 :
{
printf("tail (fan) spread\n(rad) pi / ");
scanf("%f",&tmp);
geomet[mes_fan_ang] = (signed short)(tmp * 64);
break;
}
default :
{
fprintf(stderr,"/!\\ An ERROR has occured.");
break;
}
}
}
for (unsigned char n=0;n<16;n++)
{
switch (n)
{
case mes_skull :
{
fprintf(newfile,"%d\n",geomet[mes_skull]);
break;
}
case mes_neck :
{
fprintf(newfile,"%d\n",geomet[mes_neck]);
break;
}
case mes_shld :
{
fprintf(newfile,"%d\n",geomet[mes_shld]);
break;
}
case mes_back :
{
fprintf(newfile,"%d\n",geomet[mes_back]);
break;
}
case mes_humr :
{
fprintf(newfile,"%d\n",geomet[mes_humr]);
break;
}
case mes_femr :
{
fprintf(newfile,"%d\n",geomet[mes_femr]);
break;
}
case mes_pelv :
{
fprintf(newfile,"%d\n",geomet[mes_pelv]);
break;
}
case mes_cxyx :
{
fprintf(newfile,"%d\n",geomet[mes_cxyx]);
break;
}
case mes_tail :
{
fprintf(newfile,"%d\n",geomet[mes_tail]);
break;
}
case mes_wing :
{
fprintf(newfile,"%d\n",geomet[mes_wing]);
break;
}
case mes_q :
{
fprintf(newfile,"%d\n",geomet[mes_q]);
break;
}
case mes_dig :
{
fprintf(newfile,"%d\n",geomet[mes_dig]);
break;
}
case mes_fan_len :
{
fprintf(newfile,"%d\n",geomet[mes_fan_len]);
break;
}
case mes_fan_rad :
{
fprintf(newfile,"%d\n",geomet[mes_fan_rad]);
break;
}
case mes_fan_ang :
{
fprintf(newfile,"%d\n",geomet[mes_fan_ang]);
break;
}
default :
{
break;
}
}
}
}
else
{
fprintf(stderr,"/!\\ Could not create file \"%s\"\n",filepath);
}
}