ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/common/rtmath.h
Revision: 3.3
Committed: Mon Jul 14 22:23:59 2003 UTC (20 years, 8 months ago) by schorsch
Content type: text/plain
Branch: MAIN
CVS Tags: rad3R7P2, rad3R7P1, rad3R6, rad3R6P1, rad3R8, rad3R9
Changes since 3.2: +5 -5 lines
Log Message:
Instrumented headers against multiple inclusion and for use from C++.
Moved includes in headers out of "C" scope.

File Contents

# Content
1 /* RCSid $Id: rtmath.h,v 3.2 2003/07/12 09:56:24 schorsch Exp $ */
2 /*
3 * Header for Radiance vector and math routines
4 */
5
6 #ifndef _RAD_RTMATH_H_
7 #define _RAD_RTMATH_H_
8
9 #include <math.h>
10
11 #include "tifftypes.h"
12 #include "mat4.h"
13
14 #ifdef __cplusplus
15 extern "C" {
16 #endif
17
18 /* regular transformation */
19 typedef struct {
20 MAT4 xfm; /* transform matrix */
21 RREAL sca; /* scalefactor */
22 } XF;
23 /* complemetary tranformation */
24 typedef struct {
25 XF f; /* forward */
26 XF b; /* backward */
27 } FULLXF;
28
29 #ifndef PI
30 #ifdef M_PI
31 #define PI ((double)M_PI)
32 #else
33 #define PI 3.14159265358979323846
34 #endif
35 #endif
36
37 #ifdef FASTMATH
38 #define tcos cos
39 #define tsin sin
40 #define ttan tan
41 #else
42 /* table-based cosine approximation */
43 #define tsin(x) tcos((x)-(PI/2.))
44 #define ttan(x) (tsin(x)/tcos(x))
45 #endif
46 /* defined in tcos.c */
47 extern double tcos(double x);
48 /* defined in xf.c */
49 extern int xf(XF *ret, int ac, char *av[]);
50 extern int invxf(XF *ret, int ac, char *av[]);
51 extern int fullxf(FULLXF *fx, int ac, char *av[]);
52 /* defined in zeroes.c */
53 extern int quadratic(double *r, double a, double b, double c);
54 /* defined in dircode.c */
55 extern int32 encodedir(FVECT dv);
56 extern void decodedir(FVECT dv, int32 dc);
57 extern double dir2diff(int32 dc1, int32 dc2);
58 extern double fdir2diff(int32 dc1, FVECT v2);
59
60 #ifdef __cplusplus
61 }
62 #endif
63 #endif /* _RAD_RTMATH_H_ */
64