198 |
|
|
199 |
|
getpolygon() /* get projected area for a polygon */ |
200 |
|
{ |
201 |
< |
printf("Polygon area? "); |
202 |
< |
if (!getd(&projarea)) |
203 |
< |
return(0); |
204 |
< |
projarea *= unit2meter*unit2meter; |
205 |
< |
projarea *= PI; |
201 |
> |
static double area = 1.0; |
202 |
> |
|
203 |
> |
printf("Polygon area [%g]: ", area); |
204 |
> |
getd(&area); |
205 |
> |
projarea = PI*unit2meter*unit2meter * area; |
206 |
|
return(1); |
207 |
|
} |
208 |
|
|
209 |
|
|
210 |
|
getsphere() /* get projected area for a sphere */ |
211 |
|
{ |
212 |
< |
double radius; |
212 |
> |
static double radius = 1.0; |
213 |
|
|
214 |
< |
printf("Sphere radius? "); |
215 |
< |
if (!getd(&radius)) |
216 |
< |
return(0); |
217 |
< |
radius *= unit2meter; |
218 |
< |
projarea = 4.*PI*PI*radius*radius; |
214 |
> |
printf("Sphere radius [%g]: ", radius); |
215 |
> |
getd(&radius); |
216 |
> |
projarea = 4.*PI*PI*unit2meter*unit2meter * radius*radius; |
217 |
|
return(1); |
218 |
|
} |
219 |
|
|
220 |
|
|
221 |
|
getcylinder() /* get projected area for a cylinder */ |
222 |
|
{ |
223 |
< |
double length, radius; |
223 |
> |
static double length = 1.0, radius = 0.1; |
224 |
|
|
225 |
< |
printf("Cylinder length? "); |
226 |
< |
if (!getd(&length)) |
227 |
< |
return(0); |
228 |
< |
length *= unit2meter; |
229 |
< |
printf("Cylinder radius? "); |
232 |
< |
if (!getd(&radius)) |
233 |
< |
return(0); |
234 |
< |
radius *= unit2meter; |
235 |
< |
projarea = PI*PI*2.*PI*radius*length; |
225 |
> |
printf("Cylinder length [%g]: ", length); |
226 |
> |
getd(&length); |
227 |
> |
printf("Cylinder radius [%g]: ", radius); |
228 |
> |
getd(&radius); |
229 |
> |
projarea = PI*PI*2.*PI*unit2meter*unit2meter * radius*length; |
230 |
|
return(1); |
231 |
|
} |
232 |
|
|
233 |
|
|
234 |
|
getring() /* get projected area for a ring */ |
235 |
|
{ |
236 |
< |
double radius; |
236 |
> |
static double radius = 1.0; |
237 |
|
|
238 |
< |
printf("Disk radius? "); |
239 |
< |
if (!getd(&radius)) |
240 |
< |
return(0); |
247 |
< |
radius *= unit2meter; |
248 |
< |
projarea = PI*PI*radius*radius; |
238 |
> |
printf("Disk radius [%g]: ", radius); |
239 |
> |
getd(&radius); |
240 |
> |
projarea = PI*PI*unit2meter*unit2meter * radius*radius; |
241 |
|
return(1); |
242 |
|
} |