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

Raycaster Class Reference

#include <raycaster.h>

Inheritance diagram for Raycaster:

Perspective List of all members.

Public Methods

 Raycaster ()
 ~Raycaster ()
bool SetViewingCondition (VECTOR lightpos, Color background, float ambient, float diffuse, float specular, int highlight)
virtual bool Initialize (VECTOR viewingplanepos, int width, int height, float steplength, Data *data, Transfunc *tf)
virtual bool Raycast ()
bool SetTreshold (int treshold)
bool SetRaytype (int type)
bool SetRendermode (int rendermode)
bool SetPreCalcGradients (bool pc)
bool Zoom (float zoom)
void SetWidth (int width)
void SetHeight (int height)
void SetStepLength (float steplength)
void SetViewingPlanePos (float x, float y, float z)
void SetAmbient (float ambient)
void SetDiffuse (float diffuse)
void SetSpecular (float specular)
void SetHighlight (int highlight)
void SetLightpos (VECTOR lightpos)
void SetLight (bool light)
void SetBackgroundColor (unsigned char r, unsigned char g, unsigned char b)
virtual bool RotateX (float alpha)
virtual bool RotateY (float alpha)
virtual bool RotateZ (float alpha)
bool Render (int width, int height)
rgbGetScreenShotImage (int &width, int &height)

Public Attributes

int m_dOwnType

Protected Methods

bool SetViewingMatrix ()

Protected Attributes

bool ready
bool m_light
VECTOR m_lightpos
float m_ambient
float m_diffuse
float m_steplength
float m_specular
int m_treshold
int m_highlight
Planem_viewingplane
int m_width
int m_height
Matrix4x4m_viewingtoworld
int m_raytype
int m_rendermode
rgbm_image
Datam_data
Transfuncm_tf
Color m_background
bool m_precalc
float m_zoom
float m_stepX
float m_stepY
VECTOR m_xdir
VECTOR m_ydir

Constructor & Destructor Documentation

Raycaster::Raycaster  
 

Definition at line 7 of file raycaster.cpp.

References m_ambient, m_data, m_diffuse, m_dOwnType, m_height, m_highlight, m_image, m_light, m_lightpos, m_precalc, m_raytype, m_rendermode, m_specular, m_stepX, m_stepY, m_tf, m_treshold, m_viewingplane, m_viewingtoworld, m_width, m_xdir, m_ydir, m_zoom, NN, RAYCASTER, ready, and STANDARD.

00007                      {
00008         ready = false;
00009         
00010         m_specular = 0.2f;
00011         m_highlight = 8;
00012         m_lightpos = VECTOR(300,300,300);
00013         m_light = false;
00014         m_image = NULL;
00015         m_ambient = 0.2f;
00016         m_diffuse = 0.2f;
00017         m_height = 0;
00018         m_width = 0;
00019         m_viewingplane = NULL;
00020         m_viewingtoworld = NULL;
00021         m_stepX = 1.0;
00022         m_stepY = 1.0;
00023         m_data = NULL;
00024         m_tf = NULL;
00025         m_xdir = VECTOR(1,0,0);
00026         m_ydir = VECTOR(0,1,0);
00027         m_treshold = 1500;
00028         m_rendermode = STANDARD;
00029         m_raytype = NN;
00030         m_precalc = false;
00031         m_zoom = 1.0;
00032 
00033         m_dOwnType = RAYCASTER;
00034 }

Raycaster::~Raycaster  
 

Definition at line 36 of file raycaster.cpp.

References m_image, m_viewingplane, and m_viewingtoworld.

00036                       {
00037         if(m_image != NULL) delete m_image;
00038         if(m_viewingplane != NULL) delete m_viewingplane;
00039         if(m_viewingtoworld != NULL) delete m_viewingtoworld;
00040         m_image = NULL;
00041         m_viewingplane = NULL;
00042         m_viewingtoworld = NULL;
00043 }


Member Function Documentation

rgb* Raycaster::GetScreenShotImage int &    width,
int &    height
[inline]
 

Definition at line 74 of file raycaster.h.

Referenced by CMy3dvisView::OnFileSaveImage(), and CVolumeDialog::OnShowWindow().

00074                                                          { width = m_width;
00075                                                                                                                 height = m_height;
00076                                                                                                                 return m_image; };

bool Raycaster::Initialize VECTOR    viewingplanepos,
int    width,
int    height,
float    steplength,
Data   data,
Transfunc   tf
[virtual]
 

Definition at line 74 of file raycaster.cpp.

References Data::GetXDim(), Data::GetYDim(), Data::GetZDim(), m_data, m_height, m_steplength, m_tf, m_viewingplane, m_width, VECTOR::normalize(), and Zoom().

Referenced by volumebar::OnRadioRaycaster().

00074                                                                                                                 {
00075         m_data = data;
00076         m_tf = tf;
00077         m_width = width;
00078         m_height = height;
00079         m_steplength = steplength;
00080         int maxX = m_data->GetXDim()-1;
00081         int maxY = m_data->GetYDim()-1;
00082         int maxZ = m_data->GetZDim()-1;
00083         VECTOR viewingplanenormal = VECTOR(maxX/2,maxY/2,maxZ/2)-viewingplanepos;
00084         viewingplanenormal.normalize();
00085         m_viewingplane = new Plane(viewingplanenormal,viewingplanepos);
00086 
00087         //set zoom and viewingtoworld matrix
00088         Zoom(m_zoom);
00089 
00090 
00091         if(m_viewingplane == NULL) return false;
00092         if(m_data == NULL) return false;
00093         if(m_tf == NULL) return false;
00094         return true;
00095 }

bool Raycaster::Raycast   [virtual]
 

Reimplemented in Perspective.

Definition at line 115 of file raycaster.cpp.

References Ray::CastNext(), FH, Ray::GetCurrentColor(), Ray::Initialize(), m_data, m_height, m_image, m_raytype, m_viewingplane, m_width, m_xdir, m_ydir, MI, NN, Plane::normal, Plane::point, ready, Ray::Reset(), Ray::SetLight(), Ray::SetPosDir(), Data::SetPreCalc(), Ray::SetViewingCondition(), STANDARD, Color::toRGB(), TRI, and XRAY.

Referenced by volumebar::OnButtonRenderVolume().

00115                    {
00116 
00117         CWnd* pFrame = AfxGetMainWnd();
00118 
00119 
00120         m_data->SetPreCalc(m_precalc);
00121         m_image = new rgb[m_width*m_height];
00122         
00123         VECTOR pos =  m_viewingplane->point-m_width/2*m_xdir-m_height/2*m_ydir;
00124         VECTOR backup = pos;
00125         
00126         int loadSize = (m_height * m_width) / 100;
00127         int counter = loadSize / 100;
00128         int progPos = 0;
00129 
00130 
00131 
00132         Ray *r;
00133 
00134         switch (m_rendermode) {
00135                 case STANDARD:
00136                         if (m_raytype == NN)
00137                                 r = new Ray();
00138                         else if (m_raytype == TRI)
00139                                 r = new Trilinear();
00140                         break;
00141                 case FH:
00142                         if (m_raytype == NN) {
00143                                 r = new FirstHitNN();
00144                                 ((FirstHitNN *)r)->SetTreshold(m_treshold);
00145                         }
00146                         else if (m_raytype == TRI) {
00147                                 r = new FirstHitTRI();
00148                                 ((FirstHitTRI *)r)->SetTreshold(m_treshold);
00149                         }
00150                         break;
00151                 case MI:
00152                         if (m_raytype == NN)
00153                                 r = new MaxIntensityNN();
00154                         else if (m_raytype == TRI)
00155                                 r = new MaxIntensityTRI();
00156                         break;
00157                 case XRAY:
00158                         if (m_raytype == NN)
00159                                 r = new XRayNN();
00160                         else if (m_raytype == TRI)
00161                                 r = new XRayTRI();
00162                         break;
00163         }
00164         
00165         r->SetViewingCondition(m_lightpos, m_ambient, m_diffuse, m_specular, m_highlight);
00166         r->Initialize(m_background,m_background,m_steplength,m_viewingplane,m_data,m_tf);
00167         r->SetLight(m_light);
00168 
00169         for(int j = 0; j < m_height; j++) {
00170                 for(int i = 0; i < m_width; i++) {
00171                         r->Reset();
00172                         r->SetPosDir(pos, m_viewingplane->normal);
00173                         r->CastNext();
00174                         m_image[j * m_width + i] = r->GetCurrentColor().toRGB();
00175 
00176                         pos += m_xdir;
00177 
00178                         if ((counter-- <= 0) && (progPos < 100)) {
00179                                 counter = loadSize;
00180                                 pFrame->SendMessage(MYWM_PROGRESS, progPos++);
00181                         }
00182 
00183 
00184                 } // inner for
00185                 pos = backup;
00186                 pos += j*m_ydir;
00187 
00188                 pFrame->SendMessage(MYWM_PROGRESS, 0);
00189         
00190         }
00191 
00192         
00193 /*
00194         Ray *r;
00195         Trilinear *tri;
00196         FirstHitNN *fhnn;
00197         FirstHitTRI *fhtri;
00198         MaxIntensityNN *minn;
00199         MaxIntensityTRI *mitri;
00200         XRayNN *xraynn;
00201         XRayTRI *xraytri;
00202 
00203         if(m_raytype == NN && m_rendermode == STANDARD) {
00204                 r = new Ray();
00205                 r->SetViewingCondition(m_lightpos, m_ambient, m_diffuse, m_specular, m_highlight);
00206                 r->Initialize(m_background,m_background,m_steplength,m_viewingplane,m_data,m_tf);
00207                 r->SetLight(m_light);
00208         }
00209         if(m_raytype == TRI && m_rendermode == STANDARD) {
00210                 tri = new Trilinear();
00211                 tri->SetViewingCondition(m_lightpos, m_ambient, m_diffuse, m_specular, m_highlight);
00212                 tri->Initialize(m_background,m_background,m_steplength,m_viewingplane,m_data,m_tf);
00213                 tri->SetLight(m_light);
00214         }
00215         if(m_raytype == NN && m_rendermode == FH) {
00216                 fhnn = new FirstHitNN();
00217                 fhnn->SetViewingCondition(m_lightpos, m_ambient, m_diffuse, m_specular, m_highlight);
00218                 fhnn->SetTreshold(m_treshold);
00219                 fhnn->Initialize(m_background,m_background,m_steplength,m_viewingplane,m_data,m_tf);
00220                 fhnn->SetLight(m_light);
00221         }
00222         if(m_raytype == TRI && m_rendermode == FH) {
00223                 fhtri = new FirstHitTRI();
00224                 fhtri->SetViewingCondition(m_lightpos, m_ambient, m_diffuse, m_specular, m_highlight);
00225                 fhtri->SetTreshold(m_treshold);
00226                 fhtri->Initialize(m_background,m_background,m_steplength,m_viewingplane,m_data,m_tf);
00227                 fhtri->SetLight(m_light);
00228         }
00229         if(m_raytype == NN && m_rendermode == MI) {
00230                 minn = new MaxIntensityNN();
00231                 minn->SetViewingCondition(m_lightpos, m_ambient, m_diffuse, m_specular, m_highlight);
00232                 minn->Initialize(m_background,m_background,m_steplength,m_viewingplane,m_data,m_tf);
00233         }
00234         if(m_raytype == TRI && m_rendermode == MI) {
00235                 mitri = new MaxIntensityTRI();
00236                 mitri->SetViewingCondition(m_lightpos, m_ambient, m_diffuse, m_specular, m_highlight);
00237                 mitri->Initialize(m_background,m_background,m_steplength,m_viewingplane,m_data,m_tf);
00238         }
00239         if(m_raytype == NN && m_rendermode == XRAY) {
00240                 xraynn = new XRayNN();
00241                 xraynn->SetViewingCondition(m_lightpos, m_ambient, m_diffuse, m_specular, m_highlight);
00242                 xraynn->Initialize(m_background,m_background,m_steplength,m_viewingplane,m_data,m_tf);
00243         }
00244         if(m_raytype == TRI && m_rendermode == XRAY) {
00245                 xraytri = new XRayTRI();
00246                 xraytri->SetViewingCondition(m_lightpos, m_ambient, m_diffuse, m_specular, m_highlight);
00247                 xraytri->Initialize(m_background,m_background,m_steplength,m_viewingplane,m_data,m_tf);
00248         }
00249 
00250         
00251         for(int j = 0; j < m_height; j++) {
00252                 for(int i = 0; i < m_width; i++) {
00253                         if(m_raytype == NN && m_rendermode == STANDARD) {
00254                                 r->Reset();
00255                                 r->SetPosDir(pos,m_viewingplane->normal);
00256                                 r->CastNext();
00257                                 m_image[j*m_width+i] = r->GetCurrentColor().toRGB();
00258                         }
00259                         if(m_raytype == TRI && m_rendermode == STANDARD) {
00260                                 tri->Reset();
00261                                 tri->SetPosDir(pos,m_viewingplane->normal);
00262                                 tri->CastNext();
00263                                 m_image[j*m_width+i] = tri->GetCurrentColor().toRGB();
00264                         }
00265                         if(m_raytype == NN && m_rendermode == FH) {
00266                                 fhnn->Reset();
00267                                 fhnn->SetPosDir(pos,m_viewingplane->normal);
00268                                 fhnn->CastNext();
00269                                 m_image[j*m_width+i] = fhnn->GetCurrentColor().toRGB();
00270                         }
00271                         if(m_raytype == TRI && m_rendermode == FH) {
00272                                 fhtri->Reset();
00273                                 fhtri->SetPosDir(pos,m_viewingplane->normal);
00274                                 fhtri->CastNext();
00275                                 m_image[j*m_width+i] = fhtri->GetCurrentColor().toRGB();
00276                         }
00277                         if(m_raytype == NN && m_rendermode == MI) {
00278                                 minn->Reset();
00279                                 minn->SetPosDir(pos,m_viewingplane->normal);
00280                                 minn->CastNext();
00281                                 m_image[j*m_width+i] = minn->GetCurrentColor().toRGB();
00282                         }
00283                         if(m_raytype == TRI && m_rendermode == MI) {
00284                                 mitri->Reset();
00285                                 mitri->SetPosDir(pos,m_viewingplane->normal);
00286                                 mitri->CastNext();
00287                                 m_image[j*m_width+i] = mitri->GetCurrentColor().toRGB();
00288                         }
00289                         if(m_raytype == NN && m_rendermode == XRAY) {
00290                                 xraynn->Reset();
00291                                 xraynn->SetPosDir(pos,m_viewingplane->normal);
00292                                 xraynn->CastNext();
00293                                 m_image[j*m_width+i] = xraynn->GetCurrentColor().toRGB();
00294                         }
00295                         if(m_raytype == TRI && m_rendermode == XRAY) {
00296                                 xraytri->Reset();
00297                                 xraytri->SetPosDir(pos,m_viewingplane->normal);
00298                                 xraytri->CastNext();
00299                                 m_image[j*m_width+i] = xraytri->GetCurrentColor().toRGB();
00300                         }
00301 
00302                         pos += m_xdir;
00303 
00304                         if ((counter-- <= 0) && (progPos < 100)) {
00305                                 counter = loadSize;
00306                                 pFrame->SendMessage(MYWM_PROGRESS, progPos++);
00307                         }
00308 
00309 
00310                 } // inner for
00311                 pos = backup;
00312                 pos += j*m_ydir;
00313 
00314                 pFrame->SendMessage(MYWM_PROGRESS, 0);
00315         
00316         }
00317         */
00318         if (r)
00319                 delete r;
00320         
00321         ready = true;
00322         return true;
00323 }

bool Raycaster::Render int    width,
int    height
 

Definition at line 58 of file raycaster.cpp.

References m_height, m_width, and ready.

Referenced by CMy3dvisView::RenderScene().

00058                                        {
00059 
00060         int m_x = width / 2 - m_width / 2;
00061         int m_y = height / 2 - m_height / 2;
00062 
00063 
00064         if (!ready)
00065                 return false;
00066 
00067         glRasterPos2i(m_x, m_y);
00068         glPixelStorei(GL_UNPACK_ALIGNMENT,1);
00069         glDrawPixels(m_width, m_height, GL_RGB, GL_UNSIGNED_BYTE, m_image);
00070         return true;
00071 }

bool Raycaster::RotateX float    alpha [virtual]
 

Reimplemented in Perspective.

Definition at line 361 of file raycaster.cpp.

References Data::GetXDim(), Data::GetYDim(), Data::GetZDim(), m_data, m_viewingplane, Plane::normal, VECTOR::normalize(), Plane::point, Matrix4x4::rotateX(), and SetViewingMatrix().

00361                               {
00362         Matrix4x4 rotmat;
00363         rotmat.rotateX(-alpha);
00364         m_viewingplane->point = rotmat*m_viewingplane->point;
00365         int maxX = m_data->GetXDim()-1;
00366         int maxY = m_data->GetYDim()-1;
00367         int maxZ = m_data->GetZDim()-1;
00368         m_viewingplane->normal = VECTOR(maxX/2,maxY/2,maxZ/2)-m_viewingplane->point;
00369         m_viewingplane->normal.normalize();
00370         SetViewingMatrix();
00371         return true;
00372 }

bool Raycaster::RotateY float    alpha [virtual]
 

Reimplemented in Perspective.

Definition at line 375 of file raycaster.cpp.

References Data::GetXDim(), Data::GetYDim(), Data::GetZDim(), m_data, m_viewingplane, Plane::normal, VECTOR::normalize(), Plane::point, Matrix4x4::rotateY(), and SetViewingMatrix().

00375                               {
00376         Matrix4x4 rotmat;
00377         rotmat.rotateY(-alpha);
00378         m_viewingplane->point = rotmat*m_viewingplane->point;
00379         int maxX = m_data->GetXDim()-1;
00380         int maxY = m_data->GetYDim()-1;
00381         int maxZ = m_data->GetZDim()-1;
00382         m_viewingplane->normal = VECTOR(maxX/2,maxY/2,maxZ/2)-m_viewingplane->point;
00383         m_viewingplane->normal.normalize();
00384         SetViewingMatrix();
00385         return true;
00386 }

bool Raycaster::RotateZ float    alpha [virtual]
 

Reimplemented in Perspective.

Definition at line 389 of file raycaster.cpp.

References Data::GetXDim(), Data::GetYDim(), Data::GetZDim(), m_data, m_viewingplane, Plane::normal, VECTOR::normalize(), Plane::point, Matrix4x4::rotateZ(), and SetViewingMatrix().

00389                               {
00390         Matrix4x4 rotmat;
00391         rotmat.rotateZ(-alpha);
00392         m_viewingplane->point = rotmat*m_viewingplane->point;
00393         int maxX = m_data->GetXDim()-1;
00394         int maxY = m_data->GetYDim()-1;
00395         int maxZ = m_data->GetZDim()-1;
00396         m_viewingplane->normal = VECTOR(maxX/2,maxY/2,maxZ/2)-m_viewingplane->point;
00397         m_viewingplane->normal.normalize();
00398         SetViewingMatrix();
00399         return true;
00400 }

void Raycaster::SetAmbient float    ambient [inline]
 

Definition at line 57 of file raycaster.h.

Referenced by CVolumeDialog::OnChangeEditAmbient().

00057 { m_ambient = ambient; };

void Raycaster::SetBackgroundColor unsigned char    r,
unsigned char    g,
unsigned char    b
[inline]
 

Definition at line 63 of file raycaster.h.

Referenced by CVolumeDialog::OnButtonBgcolor().

00063                                                                                    {
00064                                                                                                                 m_background = Color(r, g, b); };

void Raycaster::SetDiffuse float    diffuse [inline]
 

Definition at line 58 of file raycaster.h.

Referenced by CVolumeDialog::OnChangeEditDiffuse().

00058 { m_diffuse = diffuse; };

void Raycaster::SetHeight int    height [inline]
 

Definition at line 54 of file raycaster.h.

Referenced by CVolumeDialog::OnChangeEditHeight().

00054 { m_height = height; };

void Raycaster::SetHighlight int    highlight [inline]
 

Definition at line 60 of file raycaster.h.

Referenced by CVolumeDialog::OnChangeEditHighlight().

00060 {m_highlight = highlight;};

void Raycaster::SetLight bool    light [inline]
 

Definition at line 62 of file raycaster.h.

Referenced by CVolumeDialog::OnCheckLight().

00062 {m_light = light;};

void Raycaster::SetLightpos VECTOR    lightpos [inline]
 

Definition at line 61 of file raycaster.h.

Referenced by CVolumeDialog::OnChangeEditLightposX(), CVolumeDialog::OnChangeEditLightposY(), and CVolumeDialog::OnChangeEditLightposZ().

00061 { m_lightpos = lightpos;};

bool Raycaster::SetPreCalcGradients bool    pc [inline]
 

Definition at line 50 of file raycaster.h.

Referenced by volumebar::OnRadioPerspective(), and volumebar::OnRadioRaycaster().

00050 { m_precalc = pc; return true;};

bool Raycaster::SetRaytype int    type [inline]
 

Definition at line 48 of file raycaster.h.

Referenced by volumebar::OnRadioPerspective(), volumebar::OnRadioRaycaster(), volumebar::OnRadioVolumeNn(), and volumebar::OnRadioVolumeTri().

00048 { m_raytype = type; return true;};

bool Raycaster::SetRendermode int    rendermode [inline]
 

Definition at line 49 of file raycaster.h.

Referenced by CVolumeDialog::OnRadioFirsthit(), CVolumeDialog::OnRadioMip(), volumebar::OnRadioPerspective(), volumebar::OnRadioRaycaster(), CVolumeDialog::OnRadioStandard(), and CVolumeDialog::OnRadioXray().

00049 { m_rendermode = rendermode; return true;};

void Raycaster::SetSpecular float    specular [inline]
 

Definition at line 59 of file raycaster.h.

Referenced by CVolumeDialog::OnChangeEditSpecular().

00059 { m_specular = specular;};

void Raycaster::SetStepLength float    steplength [inline]
 

Definition at line 55 of file raycaster.h.

00055 { m_steplength = steplength; };

bool Raycaster::SetTreshold int    treshold [inline]
 

Definition at line 47 of file raycaster.h.

Referenced by CVolumeDialog::OnChangeEditFhThreshold(), volumebar::OnRadioPerspective(), and volumebar::OnRadioRaycaster().

00047 { m_treshold = treshold; return true;};

bool Raycaster::SetViewingCondition VECTOR    lightpos,
Color    background,
float    ambient,
float    diffuse,
float    specular,
int    highlight
 

Definition at line 46 of file raycaster.cpp.

References m_ambient, m_background, m_diffuse, m_highlight, m_lightpos, and m_specular.

Referenced by volumebar::OnRadioPerspective(), and volumebar::OnRadioRaycaster().

00046                                                                                                                              {
00047         m_ambient = ambient;
00048         m_diffuse = diffuse;
00049         m_background = background;
00050         m_specular = specular;
00051         m_highlight = highlight;
00052         m_lightpos = lightpos;
00053         return true;
00054 }

bool Raycaster::SetViewingMatrix   [protected]
 

Definition at line 342 of file raycaster.cpp.

References m_stepX, m_stepY, m_viewingplane, m_viewingtoworld, m_xdir, m_ydir, Plane::normal, VECTOR::normalize(), and Matrix4x4::rotation().

Referenced by Perspective::RotateX(), RotateX(), Perspective::RotateY(), RotateY(), Perspective::RotateZ(), RotateZ(), and Zoom().

00342                             {
00343         VECTOR zaxis = VECTOR(0,0,1);
00344         if(m_viewingtoworld == NULL) m_viewingtoworld = new Matrix4x4();
00345         m_viewingtoworld->rotation(zaxis,m_viewingplane->normal);
00346 
00347         m_xdir = VECTOR(1,0,0);
00348         m_ydir = VECTOR(0,1,0);
00349 
00350         m_xdir = *m_viewingtoworld*m_xdir;
00351         m_ydir = *m_viewingtoworld*m_ydir;
00352         m_xdir.normalize();
00353         m_ydir.normalize();
00354         m_xdir = m_stepX * m_xdir;
00355         m_ydir = m_stepY * m_ydir;
00356 
00357         return true;
00358 }

void Raycaster::SetViewingPlanePos float    x,
float    y,
float    z
 

Definition at line 98 of file raycaster.cpp.

References Data::GetXDim(), Data::GetYDim(), Data::GetZDim(), m_data, m_viewingplane, and VECTOR::normalize().

Referenced by CVolumeDialog::OnChangeEditX(), CVolumeDialog::OnChangeEditY(), CVolumeDialog::OnChangeEditZ(), CVolumeDialog::OnRadioVolXy(), CVolumeDialog::OnRadioVolXz(), and CVolumeDialog::OnRadioVolYz().

00098                                                             {
00099         if (!m_data)
00100                 return;
00101         
00102         VECTOR viewingplanepos = VECTOR(x, y, z);
00103         int maxX = m_data->GetXDim()-1;
00104         int maxY = m_data->GetYDim()-1;
00105         int maxZ = m_data->GetZDim()-1;
00106         VECTOR viewingplanenormal = VECTOR(maxX/2,maxY/2,maxZ/2)-viewingplanepos;
00107         viewingplanenormal.normalize();
00108         m_viewingplane = new Plane(viewingplanenormal,viewingplanepos);
00109 }

void Raycaster::SetWidth int    width [inline]
 

Definition at line 53 of file raycaster.h.

Referenced by CVolumeDialog::OnChangeEditWidth().

00053 { m_width = width; };

bool Raycaster::Zoom float    zoom
 

Definition at line 327 of file raycaster.cpp.

References Data::GetXDim(), Data::GetYDim(), Data::GetZDim(), m_data, m_height, m_stepX, m_stepY, m_width, m_zoom, and SetViewingMatrix().

Referenced by Perspective::Initialize(), Initialize(), CVolumeDialog::OnChangeEditZoom(), volumebar::OnRadioPerspective(), and volumebar::OnRadioRaycaster().

00327                           {
00328         int maxX = m_data->GetXDim()-1;
00329         int maxY = m_data->GetYDim()-1;
00330         int maxZ = m_data->GetZDim()-1;
00331         m_zoom = zoom;
00332         float maxlength = sqrtf(powf((float)maxX,2.0)+powf((float)maxY,2.0)+powf((float)maxZ,2.0));
00333         m_stepX = (1/m_zoom)*maxlength/(m_width-1);
00334         m_stepY = (1/m_zoom)*maxlength/(m_height-1);
00335 
00336         SetViewingMatrix();
00337         return true;
00338 }


Member Data Documentation

float Raycaster::m_ambient [protected]
 

Definition at line 24 of file raycaster.h.

Referenced by Raycaster(), and SetViewingCondition().

Color Raycaster::m_background [protected]
 

Definition at line 33 of file raycaster.h.

Referenced by SetViewingCondition().

Data* Raycaster::m_data [protected]
 

Definition at line 31 of file raycaster.h.

Referenced by Perspective::Initialize(), Initialize(), Perspective::Raycast(), Raycast(), Raycaster(), Perspective::RotateX(), RotateX(), Perspective::RotateY(), RotateY(), Perspective::RotateZ(), RotateZ(), SetViewingPlanePos(), and Zoom().

float Raycaster::m_diffuse [protected]
 

Definition at line 24 of file raycaster.h.

Referenced by Raycaster(), and SetViewingCondition().

int Raycaster::m_dOwnType
 

Definition at line 72 of file raycaster.h.

Referenced by volumebar::OnRadioPerspective(), volumebar::OnRadioRaycaster(), Perspective::Perspective(), and Raycaster().

int Raycaster::m_height [protected]
 

Definition at line 27 of file raycaster.h.

Referenced by Perspective::Initialize(), Initialize(), Perspective::Raycast(), Raycast(), Raycaster(), Render(), and Zoom().

int Raycaster::m_highlight [protected]
 

Definition at line 25 of file raycaster.h.

Referenced by Raycaster(), and SetViewingCondition().

rgb* Raycaster::m_image [protected]
 

Definition at line 30 of file raycaster.h.

Referenced by Perspective::Raycast(), Raycast(), Raycaster(), and ~Raycaster().

bool Raycaster::m_light [protected]
 

Definition at line 21 of file raycaster.h.

Referenced by Raycaster().

VECTOR Raycaster::m_lightpos [protected]
 

Definition at line 22 of file raycaster.h.

Referenced by Raycaster(), and SetViewingCondition().

bool Raycaster::m_precalc [protected]
 

Definition at line 34 of file raycaster.h.

Referenced by Raycaster().

int Raycaster::m_raytype [protected]
 

Definition at line 29 of file raycaster.h.

Referenced by Perspective::Raycast(), Raycast(), and Raycaster().

int Raycaster::m_rendermode [protected]
 

Definition at line 29 of file raycaster.h.

Referenced by Raycaster().

float Raycaster::m_specular [protected]
 

Definition at line 24 of file raycaster.h.

Referenced by Raycaster(), and SetViewingCondition().

float Raycaster::m_steplength [protected]
 

Definition at line 24 of file raycaster.h.

Referenced by Perspective::Initialize(), and Initialize().

float Raycaster::m_stepX [protected]
 

Definition at line 36 of file raycaster.h.

Referenced by Raycaster(), SetViewingMatrix(), and Zoom().

float Raycaster::m_stepY [protected]
 

Definition at line 36 of file raycaster.h.

Referenced by Raycaster(), SetViewingMatrix(), and Zoom().

Transfunc* Raycaster::m_tf [protected]
 

Definition at line 32 of file raycaster.h.

Referenced by Perspective::Initialize(), Initialize(), and Raycaster().

int Raycaster::m_treshold [protected]
 

Definition at line 25 of file raycaster.h.

Referenced by Raycaster().

Plane* Raycaster::m_viewingplane [protected]
 

Definition at line 26 of file raycaster.h.

Referenced by Perspective::Initialize(), Initialize(), Perspective::Raycast(), Raycast(), Raycaster(), Perspective::RotateX(), RotateX(), Perspective::RotateY(), RotateY(), Perspective::RotateZ(), RotateZ(), SetViewingMatrix(), SetViewingPlanePos(), and ~Raycaster().

Matrix4x4* Raycaster::m_viewingtoworld [protected]
 

Definition at line 28 of file raycaster.h.

Referenced by Raycaster(), SetViewingMatrix(), and ~Raycaster().

int Raycaster::m_width [protected]
 

Definition at line 27 of file raycaster.h.

Referenced by Perspective::Initialize(), Initialize(), Perspective::Raycast(), Raycast(), Raycaster(), Render(), and Zoom().

VECTOR Raycaster::m_xdir [protected]
 

Definition at line 37 of file raycaster.h.

Referenced by Perspective::Raycast(), Raycast(), Raycaster(), and SetViewingMatrix().

VECTOR Raycaster::m_ydir [protected]
 

Definition at line 37 of file raycaster.h.

Referenced by Perspective::Raycast(), Raycast(), Raycaster(), and SetViewingMatrix().

float Raycaster::m_zoom [protected]
 

Definition at line 35 of file raycaster.h.

Referenced by Raycaster(), and Zoom().

bool Raycaster::ready [protected]
 

Definition at line 20 of file raycaster.h.

Referenced by Perspective::Raycast(), Raycast(), Raycaster(), and Render().


The documentation for this class was generated from the following files:
Generated on Thu Jan 23 12:32:17 2003 by doxygen1.3-rc2