Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

ray.h

Go to the documentation of this file.
00001 #ifndef RAY_H 
00002 #define RAY_H
00003 
00004 #include <assert.h>
00005 #include "vector.h"
00006 #include "transfunc.h"
00007 #include "data.h"
00008 #include "plane.h"
00009 
00010 
00011 #define ROUND(x) (((fabs(x - floor(x))) < 0.5) ? floor(x) : ceil(x))
00012 
00013 class Ray {
00014         protected:
00015                 bool m_light;
00016                 VECTOR m_lightpos;
00017                 // calculates shading nearest neighbour
00018                 virtual Color Lighting(Color color);
00019                 
00020                 // recent position
00021                 VECTOR m_currentpos;
00022                 // ambient lighting coefficient
00023                 float m_ambient;
00024                 // diffuses lighting coefficient
00025                 float m_diffuse;
00026 
00027                 float m_specular;
00028 
00029                 int m_highlight;
00030                 // transferfunction
00031                 Transfunc *m_tf;
00032             // datavolume
00033                 Data *m_data;
00034                 // backgroundcolor
00035                 Color m_backgroundcolor;
00036                 // recent color
00037                 Color m_currentcolor;
00038                 // recent alpha
00039                 float m_alpha;
00040                 // startpoint
00041                 VECTOR m_startpoint;
00042                 // direction vector
00043                 VECTOR m_direction;
00044                 float m_steplength;
00045                 Plane * m_viewingplane;
00046 
00047                 int m_minDens, m_maxDens;
00048                 
00049                 float mx,my,mz, m_radius;
00050         public:
00051                 Ray(); 
00052                 ~Ray();
00053                 // sets viewingcondition
00054                 bool SetViewingCondition(VECTOR lightpos, float ambient, float diffuse, float specular, int highlight);
00055                 // init ray
00056                 bool Initialize(Color background, Color current, float steplength, Plane* viewingplane, Data *data, Transfunc *tf);
00057                 bool SetPosDir(VECTOR currentpos, VECTOR direction);
00058                 Color GetCurrentColor();
00059                 float GetAlpha() { return m_alpha;};
00060                 void SetLight(bool light) { m_light = light;};
00061                 virtual bool CastNext();
00062                 bool Reset() {m_alpha = 0.0; m_currentcolor = m_backgroundcolor; return true;};
00063 
00064                 void SetDensRange(int minDens, int maxDens) { m_minDens = minDens; m_maxDens = maxDens; };
00065 };
00066 
00067 class Trilinear : public Ray {
00068 protected:
00069         Color CalcColorTrilinear(VECTOR pos);
00070         gradient_t CalcGradTrilinear(VECTOR pos);
00071         float CalcAlphaTrilinear(VECTOR pos);
00072         Color Lighting(Color color); // methode calculates shading
00073         
00074 public:
00075         Trilinear() {};
00076         bool CastNext();
00077 };
00078 
00079 
00080 
00081 
00082 class FirstHitNN : public Ray {
00083 protected:
00084         int m_treshold;
00085 public:
00086         FirstHitNN(){m_treshold = 0.0;};
00087         bool SetTreshold(int treshold) { m_treshold = treshold; return true;};
00088         virtual bool CastNext();
00089 };
00090 
00091 class FirstHitTRI : public Trilinear {
00092 protected:
00093         int m_treshold;
00094         float GetDensity(VECTOR pos);
00095 public:
00096         FirstHitTRI(){m_treshold = 0.0;};
00097         bool SetTreshold(int treshold) { m_treshold = treshold; return true;};
00098         bool CastNext();
00099 };
00100 
00101 
00102 class MaxIntensityNN : public Ray {     
00103 public:
00104         MaxIntensityNN(){};
00105         ~MaxIntensityNN(){};
00106         bool CastNext();
00107 };
00108 
00109 
00110 
00111 class MaxIntensityTRI : public FirstHitTRI {    
00112 public:
00113         MaxIntensityTRI(){};
00114         ~MaxIntensityTRI(){};
00115         bool CastNext();
00116 };
00117 
00118 class XRayNN : public Ray {
00119 public:
00120         XRayNN(){};
00121         ~XRayNN(){};
00122         bool CastNext();
00123 };
00124 
00125 class XRayTRI : public FirstHitTRI {
00126 public:
00127         XRayTRI(){};
00128         ~XRayTRI(){};
00129         bool CastNext();
00130 };
00131 
00132 #endif

Generated on Thu Jan 30 21:35:43 2003 for 3DVis by doxygen1.3-rc2