1 /*
2   Teem: Tools to process and visualize scientific data and images             .
3   Copyright (C) 2012, 2011, 2010, 2009  University of Chicago
4   Copyright (C) 2008, 2007, 2006, 2005  Gordon Kindlmann
5   Copyright (C) 2004, 2003, 2002, 2001, 2000, 1999, 1998  University of Utah
6 
7   This library is free software; you can redistribute it and/or
8   modify it under the terms of the GNU Lesser General Public License
9   (LGPL) as published by the Free Software Foundation; either
10   version 2.1 of the License, or (at your option) any later version.
11   The terms of redistributing and/or modifying this software also
12   include exceptions to the LGPL that facilitate static linking.
13 
14   This library is distributed in the hope that it will be useful,
15   but WITHOUT ANY WARRANTY; without even the implied warranty of
16   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17   Lesser General Public License for more details.
18 
19   You should have received a copy of the GNU Lesser General Public License
20   along with this library; if not, write to Free Software Foundation, Inc.,
21   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
22 */
23 
24 #ifndef ECHO_PRIVATE_HAS_BEEN_INCLUDED
25 #define ECHO_PRIVATE_HAS_BEEN_INCLUDED
26 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
31 #if ECHO_POS_FLOAT
32 #  define echoPos_nt nrrdTypeFloat
33 #  define echoPos_at airTypeFloat
34 #  define ell_4m_INV ell_4m_inv_f
35 #  define ell_4m_PRINT ell_4m_print_f
36 #  define ell_4m_DET ell_4m_det_f
37 #  define ell_3v_PERP ell_3v_perp_f
38 #  define ell_4m_POST_MUL ell_4m_post_mul_f
39 #  define ECHO_POS_MIN (-FLT_MAX)
40 #  define ECHO_POS_MAX FLT_MAX
41 #  define ECHO_POS_EPS FLT_EPSILON
42 #else
43 #  define echoPos_nt nrrdTypeDouble
44 #  define echoPos_at airTypeDouble
45 #  define ell_4m_INV ell_4m_inv_d
46 #  define ell_4m_PRINT ell_4m_print_d
47 #  define ell_4m_DET ell_4m_det_d
48 #  define ell_3v_PERP ell_3v_perp_d
49 #  define ell_4m_POST_MUL ell_4m_post_mul_d
50 #  define ECHO_POS_MIN (-DBL_MAX)
51 #  define ECHO_POS_MAX DBL_MAX
52 #  define ECHO_POS_EPS DBL_EPSILON
53 #endif
54 
55 #define OBJECT(obj)    ((echoObject*)obj)
56 #define SPLIT(obj)     ((echoSplit*)obj)
57 #define LIST(obj)      ((echoList*)obj)
58 #define SPHERE(obj)    ((echoSphere*)obj)
59 #define CYLINDER(obj)  ((echoCylinder*)obj)
60 #define SUPERQUAD(obj) ((echoSuperquad*)obj)
61 #define RECTANGLE(obj) ((echoRectangle*)obj)
62 #define AABBOX(obj)    ((echoAABBox*)obj)
63 #define TRIMESH(obj)   ((echoTriMesh*)obj)
64 #define TRIANGLE(obj)  ((echoTriangle*)obj)
65 #define INSTANCE(obj)  ((echoInstance*)obj)
66 
67 #define _ECHO_REFLECT(refl, norm, view, tmp) \
68   (tmp) = 2*ELL_3V_DOT((view), (norm)); \
69   ELL_3V_SCALE_ADD2((refl), -1.0, (view), (tmp), (norm))
70 
71 #define ECHO_NEW(TYPE) \
72   (echoObject##TYPE *)echoNew(echoObject##Type)
73 
74 /* methodsEcho.c */
75 extern void _echoSceneLightAdd(echoScene *scene, echoObject *obj);
76 extern void _echoSceneNrrdAdd(echoScene *scene, Nrrd *nrrd);
77 
78 /* intx.c */
79 #define RAYINTX_ARGS(TYPE) echoIntx *intx, echoRay *ray, \
80                            echo##TYPE *obj, echoRTParm *parm,  \
81                            echoThreadState *tstate
82 typedef int (*_echoRayIntx_t)(RAYINTX_ARGS(Object));
83 extern _echoRayIntx_t _echoRayIntx[/* object type idx */];
84 typedef void (*_echoRayIntxUV_t)(echoIntx *intx);
85 extern _echoRayIntxUV_t _echoRayIntxUV[/* object type idx */];
86 extern int _echoRayIntx_CubeSolid(echoPos_t *tminP, echoPos_t *tmaxP,
87                                   echoPos_t xmin, echoPos_t xmax,
88                                   echoPos_t ymin, echoPos_t ymax,
89                                   echoPos_t zmin, echoPos_t zmax,
90                                   echoRay *ray);
91 
92 /* sqd.c */
93 extern int _echoRayIntx_Superquad(RAYINTX_ARGS(Superquad));
94 
95 /* color.c */
96 extern char _echoBuff[];
97 extern char *_echoDot(int depth);
98 #define INTXCOLOR_ARGS echoCol_t rgba[4], echoIntx *intx,  \
99                        echoScene *scene, echoRTParm *parm, \
100                        echoThreadState *tstate
101 typedef void (*_echoIntxColor_t)(INTXCOLOR_ARGS);
102 extern _echoIntxColor_t _echoIntxColor[/* matter idx */];
103 
104 #ifdef __cplusplus
105 }
106 #endif
107 
108 #endif /*  ECHO_PRIVATE_HAS_BEEN_INCLUDED */
109