ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/common/rtmath.h
Revision: 3.8
Committed: Sat Aug 3 17:53:46 2013 UTC (10 years, 8 months ago) by greg
Content type: text/plain
Branch: MAIN
CVS Tags: rad4R2P2, rad5R0, rad4R2, rad4R2P1
Changes since 3.7: +6 -2 lines
Log Message:
Fixed lack of erf() and erfc() under Windows

File Contents

# Content
1 /* RCSid $Id: rtmath.h,v 3.7 2013/06/29 15:46:02 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 /* regular transformation */
18 typedef struct {
19 MAT4 xfm; /* transform matrix */
20 RREAL sca; /* scalefactor */
21 } XF;
22 /* complemetary tranformation */
23 typedef struct {
24 XF f; /* forward */
25 XF b; /* backward */
26 } FULLXF;
27
28 #ifndef PI
29 #ifdef M_PI
30 #define PI ((double)M_PI)
31 #else
32 #define PI 3.14159265358979323846
33 #endif
34 #endif
35 /* defined in tcos.c */
36 extern double tcos(double x);
37 extern double atan2a(double y, double x);
38
39 #ifdef __FAST_MATH__
40 #define tcos cos
41 #define tsin sin
42 #define ttan tan
43 #else
44 /* table-based cosine approximation */
45 #define tsin(x) tcos((x)-(PI/2.))
46 #define ttan(x) (tsin(x)/tcos(x))
47 #endif
48
49 #ifdef _WIN32
50 extern double erf(double x);
51 extern double erfc(double x);
52 #endif
53 /* defined in xf.c */
54 extern int xf(XF *ret, int ac, char *av[]);
55 extern int invxf(XF *ret, int ac, char *av[]);
56 extern int fullxf(FULLXF *fx, int ac, char *av[]);
57 /* defined in zeroes.c */
58 extern int quadratic(double *r, double a, double b, double c);
59 /* defined in dircode.c */
60 extern int32 encodedir(FVECT dv);
61 extern void decodedir(FVECT dv, int32 dc);
62 extern double dir2diff(int32 dc1, int32 dc2);
63 extern double fdir2diff(int32 dc1, FVECT v2);
64
65 #ifdef __cplusplus
66 }
67 #endif
68 #endif /* _RAD_RTMATH_H_ */
69