ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/common/rtmath.h
Revision: 3.7
Committed: Sat Jun 29 15:46:02 2013 UTC (10 years, 10 months ago) by greg
Content type: text/plain
Branch: MAIN
Changes since 3.6: +2 -2 lines
Log Message:
Fixed incorrect macro for fast-math option

File Contents

# Content
1 /* RCSid $Id: rtmath.h,v 3.6 2013/02/08 16:10:07 greg 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 "tiff.h" /* needed for int32, etc. */
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 /* defined in tcos.c */
37 extern double tcos(double x);
38 extern double atan2a(double y, double x);
39
40 #ifdef __FAST_MATH__
41 #define tcos cos
42 #define tsin sin
43 #define ttan tan
44 #else
45 /* table-based cosine approximation */
46 #define tsin(x) tcos((x)-(PI/2.))
47 #define ttan(x) (tsin(x)/tcos(x))
48 #endif
49 /* defined in xf.c */
50 extern int xf(XF *ret, int ac, char *av[]);
51 extern int invxf(XF *ret, int ac, char *av[]);
52 extern int fullxf(FULLXF *fx, int ac, char *av[]);
53 /* defined in zeroes.c */
54 extern int quadratic(double *r, double a, double b, double c);
55 /* defined in dircode.c */
56 extern int32 encodedir(FVECT dv);
57 extern void decodedir(FVECT dv, int32 dc);
58 extern double dir2diff(int32 dc1, int32 dc2);
59 extern double fdir2diff(int32 dc1, FVECT v2);
60
61 #ifdef __cplusplus
62 }
63 #endif
64 #endif /* _RAD_RTMATH_H_ */
65