--- ray/src/gen/genrev.c 1989/10/18 17:43:46 1.3 +++ ray/src/gen/genrev.c 1990/03/07 11:14:40 1.5 @@ -1,9 +1,9 @@ -/* Copyright (c) 1989 Regents of the University of California */ - #ifndef lint static char SCCSid[] = "$SunId$ LBL"; #endif +/* Copyright (c) 1989 Regents of the University of California */ + /* * genrev.c - program to generate functions of rotation about z * @@ -28,7 +28,7 @@ static char SCCSid[] = "$SunId$ LBL"; #define UP 04 #define DOWN 010 -double funvalue(), l_hermite(), argument(); +double funvalue(), l_hermite(), l_bezier(), l_bspline(), argument(); main(argc, argv) @@ -45,6 +45,8 @@ char *argv[]; varset("PI", PI); funset("hermite", 5, l_hermite); + funset("bezier", 5, l_bezier); + funset("bspline", 5, l_bspline); if (argc < 6) goto userror; @@ -210,4 +212,30 @@ l_hermite() argument(2)*(-2.0*t+3.0)*t*t + argument(3)*((t-2.0)*t+1.0)*t + argument(4)*(t-1.0)*t*t ); +} + + +double +l_bezier() +{ + double t; + + t = argument(5); + return( argument(1) * (1.+t*(-3.+t*(3.-t))) + + argument(2) * 3.*t*(1.+t*(-2.+t)) + + argument(3) * 3.*t*t*(1.-t) + + argument(4) * t*t*t ); +} + + +double +l_bspline() +{ + double t; + + t = argument(5); + return( argument(1) * (1./6.+t*(-1./2.+t*(1./2.-1./6.*t))) + + argument(2) * (2./3.+t*t*(-1.+1./2.*t)) + + argument(3) * (1./6.+t*(1./2.+t*(1./2.-1./2.*t))) + + argument(4) * (1./6.*t*t*t) ); }