ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/gen/genbeads.c
(Generate patch)

Comparing ray/src/gen/genbeads.c (file contents):
Revision 2.3 by greg, Fri Jun 4 14:29:20 1993 UTC vs.
Revision 2.7 by schorsch, Sun Nov 16 10:29:38 2003 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines