--- ray/src/gen/genworm.c 1989/02/02 11:16:31 1.1 +++ ray/src/gen/genworm.c 1990/03/02 17:24:05 1.3 @@ -1,8 +1,10 @@ -/* +/* Copyright (c) 1989 Regents of the University of California */ #ifndef lint static char SCCSid[] = "$SunId$ LBL"; #endif + +/* * genworm.c - program to generate worms (strings with varying thickness). * * The program takes as input the functions of t for x, y, @@ -28,7 +30,7 @@ static char SCCSid[] = "$SunId$ LBL"; #define max(a,b) ((a) > (b) ? (a) : (b)) -double funvalue(), l_hermite(), argument(); +double funvalue(), l_hermite(), l_bezier(), argument(); main(argc, argv) @@ -42,6 +44,7 @@ char *argv[]; varset("PI", PI, NULL); funset("hermite", 5, l_hermite); + funset("bezier", 5, l_bezier); if (argc < 8) goto userror; @@ -160,4 +163,17 @@ 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 ); }