ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/gen/genbeads.c
Revision: 2.5
Committed: Sat Feb 22 02:07:23 2003 UTC (21 years, 2 months ago) by greg
Content type: text/plain
Branch: MAIN
CVS Tags: rad3R5
Changes since 2.4: +2 -8 lines
Log Message:
Changes and check-in for 3.5 release
Includes new source files and modifications not recorded for many years
See ray/doc/notes/ReleaseNotes for notes between 3.1 and 3.5 release

File Contents

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