ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/gen/hermite3.c
Revision: 2.4
Committed: Sun Nov 16 10:29:38 2003 UTC (20 years, 4 months ago) by schorsch
Content type: text/plain
Branch: MAIN
CVS Tags: rad5R4, rad5R2, rad4R2P2, rad5R0, rad5R1, rad3R7P2, rad3R7P1, rad4R2, rad4R1, rad4R0, rad3R6, rad3R6P1, rad3R8, rad3R9, rad4R2P1, rad5R3, HEAD
Changes since 2.3: +2 -1 lines
Log Message:
Continued ANSIfication and reduced other compile warnings.

File Contents

# Content
1 #ifndef lint
2 static const char RCSid[] = "$Id: hermite3.c,v 2.3 2003/06/08 12:03:09 schorsch Exp $";
3 #endif
4 /*
5 * hermite.c - routines for 3D hermite curves.
6 *
7 * 10/29/85
8 */
9
10 #include <stdio.h>
11
12 void
13 hermite3( /* compute point on hermite curve */
14 double hp[3], /* returned hermite point */
15 double p0[3], /* first endpoint */
16 double p1[3], /* second endpoint */
17 double r0[3], /* tangent at p0 */
18 double r1[3], /* tangent at p1 */
19 double t /* position parameter */
20 )
21 {
22 register int i;
23 double tmh[4];
24
25 tmh[0] = (2.0*t - 3.0)*t*t + 1.0;
26 tmh[1] = (-2.0*t + 3.0)*t*t;
27 tmh[2] = ((t - 2.0)*t + 1.0)*t;
28 tmh[3] = (t - 1.0)*t*t;
29
30 for (i = 0; i < 3; i++)
31 hp[i] = p0[i]*tmh[0] + p1[i]*tmh[1] +
32 r0[i]*tmh[2] + r1[i]*tmh[3];
33 }
34
35
36 void
37 htan3( /* compute tangent on hermite curve */
38 double ht[3], /* returned hermite tangent */
39 double p0[3], /* first endpoint */
40 double p1[3], /* second endpoint */
41 double r0[3], /* tangent at p0 */
42 double r1[3], /* tangent at p1 */
43 double t /* position parameter */
44 )
45 {
46 register int i;
47 double tpmh[4];
48
49 tpmh[0] = (6.0*t - 6.0)*t;
50 tpmh[1] = (-6.0*t + 6.0)*t;
51 tpmh[2] = (3.0*t - 4.0)*t + 1.0;
52 tpmh[3] = (3.0*t - 2.0)*t;
53
54 for (i = 0; i < 3; i++)
55 ht[i] = p0[i]*tpmh[0] + p1[i]*tpmh[1] +
56 r0[i]*tpmh[2] + r1[i]*tpmh[3];
57 }