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

Comparing ray/src/gen/gensurf.c (file contents):
Revision 1.4 by greg, Wed Oct 18 18:49:09 1989 UTC vs.
Revision 1.7 by greg, Wed Mar 7 11:14:36 1990 UTC

# Line 1 | Line 1
1 /* Copyright (c) 1989 Regents of the University of California */
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   *  gensurf.c - program to generate functional surfaces
9   *
# Line 16 | Line 16 | static char SCCSid[] = "$SunId$ LBL";
16   *      4/3/87
17   */
18  
19 < #include  <stdio.h>
20 < #include  "fvect.h"
19 > #include  "standard.h"
20  
21   #define  XNAME          "X_"                    /* x function name */
22   #define  YNAME          "Y_"                    /* y function name */
23   #define  ZNAME          "Z_"                    /* z function name */
24  
26 #define  PI             3.14159265358979323846
27
28 #define  FTINY          1e-7
29
25   #define  ABS(x)         ((x)>=0 ? (x) : -(x))
26  
27   #define  pvect(p)       printf(vformat, (p)[0], (p)[1], (p)[2])
# Line 39 | Line 34 | int  smooth = 0;               /* apply smoothing? */
34  
35   char  *modname, *surfname;
36  
37 < double  funvalue(), l_hermite(), argument();
37 > double  funvalue(), l_hermite(), l_bezier(), l_bspline(), argument();
38  
39   typedef struct {
40          FVECT  p;       /* vertex position */
# Line 57 | Line 52 | char  *argv[];
52  
53          varset("PI", PI);
54          funset("hermite", 5, l_hermite);
55 +        funset("bezier", 5, l_bezier);
56 +        funset("bspline", 5, l_bspline);
57  
58          if (argc < 8)
59                  goto userror;
# Line 334 | Line 331 | double mat[4][4],inverse[4][4];
331          register int i,j,k;
332          register double temp;
333  
334 <        bcopy(mat, m4tmp, sizeof(m4tmp));
334 >        bcopy((char *)mat, (char *)m4tmp, sizeof(m4tmp));
335                                          /* set inverse to identity */
336          for (i = 0; i < 4; i++)
337                  for (j = 0; j < 4; j++)
# Line 420 | Line 417 | l_hermite()                    
417                  argument(2)*(-2.0*t+3.0)*t*t +
418                  argument(3)*((t-2.0)*t+1.0)*t +
419                  argument(4)*(t-1.0)*t*t );
420 + }
421 +
422 +
423 + double
424 + l_bezier()
425 + {
426 +        double  t;
427 +
428 +        t = argument(5);
429 +        return( argument(1) * (1.+t*(-3.+t*(3.-t))) +
430 +                argument(2) * 3.*t*(1.+t*(-2.+t)) +
431 +                argument(3) * 3.*t*t*(1.-t) +
432 +                argument(4) * t*t*t );
433 + }
434 +
435 +
436 + double
437 + l_bspline()
438 + {
439 +        double  t;
440 +
441 +        t = argument(5);
442 +        return( argument(1) * (1./6.+t*(-1./2.+t*(1./2.-1./6.*t))) +
443 +                argument(2) * (2./3.+t*t*(-1.+1./2.*t)) +
444 +                argument(3) * (1./6.+t*(1./2.+t*(1./2.-1./2.*t))) +
445 +                argument(4) * (1./6.*t*t*t) );
446   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines