| 1 |
– |
/* Copyright (c) 1986 Regents of the University of California */ |
| 2 |
– |
|
| 1 |
|
#ifndef lint |
| 2 |
< |
static char SCCSid[] = "$SunId$ LBL"; |
| 2 |
> |
static const char RCSid[] = "$Id$"; |
| 3 |
|
#endif |
| 6 |
– |
|
| 4 |
|
/* |
| 5 |
|
* genmarble.c - generate a marble with bubbles inside. |
| 6 |
|
* |
| 9 |
|
|
| 10 |
|
#include <stdio.h> |
| 11 |
|
|
| 12 |
< |
#include "random.h" |
| 12 |
> |
#include <stdlib.h> |
| 13 |
|
|
| 14 |
+ |
#include <math.h> |
| 15 |
|
|
| 16 |
+ |
#include "random.h" |
| 17 |
+ |
|
| 18 |
|
#define PI 3.14159265359 |
| 19 |
|
|
| 20 |
|
typedef double FVECT[3]; |
| 21 |
|
|
| 22 |
< |
double bubble(); /* pretty cute, huh? */ |
| 22 |
> |
static double bubble(); /* pretty cute, huh? */ |
| 23 |
> |
static void sphere_cart(); |
| 24 |
|
|
| 25 |
< |
|
| 25 |
> |
int |
| 26 |
|
main(argc, argv) |
| 27 |
|
int argc; |
| 28 |
|
char **argv; |
| 29 |
|
{ |
| 29 |
– |
double atof(); |
| 30 |
|
char *cmtype, *cname; |
| 31 |
|
FVECT cent; |
| 32 |
|
double rad; |
| 68 |
|
} |
| 69 |
|
|
| 70 |
|
|
| 71 |
< |
double |
| 71 |
> |
static double |
| 72 |
|
bubble(v, cent, rad, bubrad) /* compute location of random bubble */ |
| 73 |
|
FVECT v, cent; |
| 74 |
|
double rad, bubrad; |
| 75 |
|
{ |
| 76 |
– |
double sqrt(); |
| 76 |
|
double r, ro, theta, phi; |
| 77 |
|
|
| 78 |
|
r = frandom()*bubrad; |
| 85 |
|
} |
| 86 |
|
|
| 87 |
|
|
| 88 |
+ |
static void |
| 89 |
|
sphere_cart(v, ro, theta, phi) /* spherical to cartesian coord. conversion */ |
| 90 |
|
FVECT v; |
| 91 |
|
double ro, theta, phi; |
| 92 |
|
{ |
| 93 |
– |
double sin(), cos(); |
| 93 |
|
double d; |
| 94 |
|
|
| 95 |
|
d = sin(phi); |