ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/gen/hermite3.c
Revision: 2.2
Committed: Sat Feb 22 02:07:23 2003 UTC (21 years, 2 months ago) by greg
Content type: text/plain
Branch: MAIN
CVS Tags: rad3R5
Changes since 2.1: +1 -4 lines
Log Message:
Changes and check-in for 3.5 release
Includes new source files and modifications not recorded for many years
See ray/doc/notes/ReleaseNotes for notes between 3.1 and 3.5 release

File Contents

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