ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/gen/genbeads.c
Revision: 2.2
Committed: Thu Dec 19 15:07:08 1991 UTC (32 years, 4 months ago) by greg
Content type: text/plain
Branch: MAIN
Changes since 2.1: +4 -1 lines
Log Message:
removed atof declaration for NeXT

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
16
17 #ifndef atof
18 extern double atof();
19 #endif
20
21 char *mtype; /* material type */
22
23 char *name; /* name */
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 double sqrt();
72 register int i;
73 double v[3];
74 double t;
75
76 t = 0.0;
77 for (i = 0; t <= 1.0; i++) {
78
79 printf("\n%s sphere %s.%d\n", mtype, name, i);
80
81 hermite3(v, p0, p1, r0, r1, t);
82
83 printf("0\n0\n4 %18.12g %18.12g %18.12g %18.12g\n",
84 v[0], v[1], v[2], rad);
85
86 htan3(v, p0, p1, r0, r1, t);
87 t += inc / sqrt(v[0]*v[0] + v[1]*v[1] + v[2]*v[2]);
88 }
89 }