| 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 |
|
* |
| 34 |
|
|
| 35 |
|
char *modname, *surfname; |
| 36 |
|
|
| 37 |
< |
double funvalue(), l_hermite(), l_bezier(), argument(); |
| 37 |
> |
double funvalue(), l_hermite(), l_bezier(), l_bspline(), argument(); |
| 38 |
|
|
| 39 |
|
typedef struct { |
| 40 |
|
FVECT p; /* vertex position */ |
| 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; |
| 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 |
|
} |