ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/gen/genbeads.c
Revision: 2.4
Committed: Mon Aug 2 14:22:56 1993 UTC (30 years, 8 months ago) by greg
Content type: text/plain
Branch: MAIN
Changes since 2.3: +4 -0 lines
Log Message:
added conditional declaration of atof()

File Contents

# Content
1 /* Copyright (c) 1986 Regents of the University of California */
2
3 #ifndef lint
4 static char SCCSid[] = "$SunId$ LBL";
5 #endif
6
7 /*
8 * genbeads.c - generate a string of spheres using Hermite
9 * curve specification.
10 *
11 * 10/29/85
12 */
13
14 #include <stdio.h>
15 #include <math.h>
16
17 char *mtype; /* material type */
18
19 char *name; /* name */
20
21 #ifdef DCL_ATOF
22 extern double atof();
23 #endif
24
25
26 main(argc, argv)
27 int argc;
28 char **argv;
29 {
30 double p0[3], p1[3], r0[3], r1[3];
31 double rad, inc;
32
33 if (argc != 17) {
34 fprintf(stderr, "Usage: %s material name p0 p1 r0 r1 rad inc\n",
35 argv[0]);
36 exit(1);
37 }
38 mtype = argv[1];
39 name = argv[2];
40 p0[0] = atof(argv[3]);
41 p0[1] = atof(argv[4]);
42 p0[2] = atof(argv[5]);
43 p1[0] = atof(argv[6]);
44 p1[1] = atof(argv[7]);
45 p1[2] = atof(argv[8]);
46 r0[0] = atof(argv[9]);
47 r0[1] = atof(argv[10]);
48 r0[2] = atof(argv[11]);
49 r1[0] = atof(argv[12]);
50 r1[1] = atof(argv[13]);
51 r1[2] = atof(argv[14]);
52 rad = atof(argv[15]);
53 inc = atof(argv[16]);
54
55 genstring(mtype, name, p0, p1, r0, r1, rad, inc);
56
57 return(0);
58 }
59
60
61 genstring(mtype, name, p0, p1, r0, r1, rad, inc)
62 char *mtype;
63 char *name;
64 double p0[3];
65 double p1[3];
66 double r0[3];
67 double r1[3];
68 double rad;
69 double inc;
70 {
71 register int i;
72 double v[3];
73 double t;
74
75 t = 0.0;
76 for (i = 0; t <= 1.0; i++) {
77
78 printf("\n%s sphere %s.%d\n", mtype, name, i);
79
80 hermite3(v, p0, p1, r0, r1, t);
81
82 printf("0\n0\n4 %18.12g %18.12g %18.12g %18.12g\n",
83 v[0], v[1], v[2], rad);
84
85 htan3(v, p0, p1, r0, r1, t);
86 t += inc / sqrt(v[0]*v[0] + v[1]*v[1] + v[2]*v[2]);
87 }
88 }