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

Comparing ray/src/gen/genrev.c (file contents):
Revision 1.1 by greg, Thu Feb 2 11:16:29 1989 UTC vs.
Revision 1.9 by greg, Tue Apr 23 15:51:17 1991 UTC

# Line 1 | Line 1
1 /*
2
1   #ifndef lint
2   static char SCCSid[] = "$SunId$ LBL";
3   #endif
4 +
5 + /* Copyright (c) 1989 Regents of the University of California */
6 +
7 + /*
8   *  genrev.c - program to generate functions of rotation about z
9   *
10   *      The program takes as input the functions of t for z and r
# Line 26 | Line 28 | static char SCCSid[] = "$SunId$ LBL";
28   #define  UP             04
29   #define  DOWN           010
30  
31 < double  funvalue(), l_hermite(), argument();
31 > double  funvalue(), l_hermite(), l_bezier(), l_bspline(), argument();
32  
33  
34   main(argc, argv)
35   int  argc;
36   char  *argv[];
37   {
38 +        extern long     eclock;
39          char  stmp[256];
40          char  *modname;
41          int  smooth = 0;
# Line 41 | Line 44 | char  *argv[];
44          int  i, nseg;
45          int  orient;
46  
47 <        varset("PI", PI);
48 <        funset("hermite", 5, l_hermite);
47 >        varset("PI", ':', PI);
48 >        funset("hermite", 5, ':', l_hermite);
49 >        funset("bezier", 5, ':', l_bezier);
50 >        funset("bspline", 5, ':', l_bspline);
51  
52          if (argc < 6)
53                  goto userror;
54  
55          for (i = 6; i < argc; i++)
56                  if (!strcmp(argv[i], "-e"))
57 <                        scompile(NULL, argv[++i]);
57 >                        scompile(argv[++i], NULL, 0);
58                  else if (!strcmp(argv[i], "-f"))
59                          fcompile(argv[++i]);
60                  else if (!strcmp(argv[i], "-s"))
# Line 58 | Line 63 | char  *argv[];
63                          goto userror;
64  
65          sprintf(stmp, "%s(t)=%s;", ZNAME, argv[3]);
66 <        scompile(NULL, stmp);
66 >        scompile(stmp, NULL, 0);
67          sprintf(stmp, "%s(t)=%s;", RNAME, argv[4]);
68 <        scompile(NULL, stmp);
68 >        scompile(stmp, NULL, 0);
69          nseg = atoi(argv[5]);
70          if (nseg <= 0)
71                  goto userror;
72 <        modname = smooth ? "phong" : argv[1];
72 >        modname = smooth ? "Phong" : argv[1];
73  
74          printhead(argc, argv);
75 +        eclock = 0;
76  
77          lastnz = lastnr = 0.0;
78          t = 0.0;
# Line 96 | Line 102 | char  *argv[];
102                  if (!orient)
103                          goto endfor;
104                  if (smooth) {
105 <                        printf("\n%s texfunc phong\n", argv[1]);
105 >                        printf("\n%s texfunc Phong\n", argv[1]);
106                          printf("4 rev_dx rev_dy rev_dz rev.cal\n");
107                          printf("0\n4\n");
108                          if (orient&(UP|DOWN)) {
# Line 208 | Line 214 | l_hermite()                    
214                  argument(2)*(-2.0*t+3.0)*t*t +
215                  argument(3)*((t-2.0)*t+1.0)*t +
216                  argument(4)*(t-1.0)*t*t );
217 + }
218 +
219 +
220 + double
221 + l_bezier()
222 + {
223 +        double  t;
224 +
225 +        t = argument(5);
226 +        return( argument(1) * (1.+t*(-3.+t*(3.-t))) +
227 +                argument(2) * 3.*t*(1.+t*(-2.+t)) +
228 +                argument(3) * 3.*t*t*(1.-t) +
229 +                argument(4) * t*t*t );
230 + }
231 +
232 +
233 + double
234 + l_bspline()
235 + {
236 +        double  t;
237 +
238 +        t = argument(5);
239 +        return( argument(1) * (1./6.+t*(-1./2.+t*(1./2.-1./6.*t))) +
240 +                argument(2) * (2./3.+t*t*(-1.+1./2.*t)) +
241 +                argument(3) * (1./6.+t*(1./2.+t*(1./2.-1./2.*t))) +
242 +                argument(4) * (1./6.*t*t*t) );
243   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines