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

FirstHitNN Class Reference

#include <ray.h>

Inheritance diagram for FirstHitNN:

Ray List of all members.

Public Methods

 FirstHitNN ()
bool SetTreshold (int treshold)
virtual bool CastNext ()

Protected Attributes

int m_treshold

Constructor & Destructor Documentation

FirstHitNN::FirstHitNN   [inline]
 

Definition at line 86 of file ray.h.

00086 {m_treshold = 0.0;};


Member Function Documentation

bool FirstHitNN::CastNext   [virtual]
 

berechnet den farbwert eines Strahls indem er das Volumen an diskreten Punkten abtastet, dort einen Dichtewert erhält, ist dieser Dichtewerte größer als ein zuvor gesetztes Minimum so wird dieser zur Farbberechnung herangezogen und kein weiterer Schritt in das volumen getätigt, andernfalls wird im Volumen vorwärts gegangen bis das Ende des Volumens erreicht ist

Reimplemented from Ray.

Definition at line 324 of file ray.cpp.

References Data::GetDensity(), Transfunc::GetDensityColor(), Transfunc::GetOpacity(), VECTOR::length(), Ray::Lighting(), Ray::m_alpha, Ray::m_backgroundcolor, Ray::m_currentcolor, Ray::m_currentpos, Ray::m_data, Ray::m_direction, Ray::m_radius, Ray::m_startpoint, Ray::m_steplength, Ray::m_tf, m_treshold, Ray::mx, Ray::my, Ray::mz, ROUND, VECTOR::x, VECTOR::y, and VECTOR::z.

00324                      {
00325         
00326         if(m_data == NULL) return false;
00327         if(m_tf == NULL) return false;
00328         
00329         int step_count = 0;
00330         bool first = true;
00331         VECTOR distancetomidpoint = VECTOR(mx/2.0f,my/2.0f,mz/2.0f)-m_currentpos;
00332         int steps = (int)((distancetomidpoint.length() + m_radius)/m_steplength);
00333         do {
00334                 
00335                 if((m_currentpos.x >= 0.0)&&(m_currentpos.y >= 0.0)&&(m_currentpos.z >= 0.0)&&(m_currentpos.x < mx)&&(m_currentpos.y < my)&&(m_currentpos.z < mz)) {
00336                         if(first) {
00337                                 m_startpoint = VECTOR(m_currentpos.x,m_currentpos.y,m_currentpos.z);
00338                                 first = false;
00339                         }
00340                         int d = m_data->GetDensity((int)ROUND(m_currentpos.x),(int)ROUND(m_currentpos.y),(int)ROUND(m_currentpos.z));
00341                         if(d > m_treshold) {
00342                                 Color help_color = m_tf->GetDensityColor(d);
00343                                 float help_alpha = m_tf->GetOpacity(d);
00344                                 // lightning:
00345                                 help_color = Lighting(help_color);
00346                                 // calculate new currentcolor:
00347                                 m_currentcolor = help_color;
00348                                 // calculate new alphavalue
00349                                 m_alpha = help_alpha;
00350                                 break;
00351                         }
00352                 }
00353                 // calculate new position
00354                 m_currentpos += m_steplength*m_direction;
00355                 
00356                 step_count++;
00357         }while(step_count <= steps);
00358         if(m_alpha < 1.0 ) m_currentcolor += m_backgroundcolor*(1.0 - m_alpha);
00359         return true;
00360 }

bool FirstHitNN::SetTreshold int    treshold [inline]
 

Definition at line 87 of file ray.h.

00087 { m_treshold = treshold; return true;};


Member Data Documentation

int FirstHitNN::m_treshold [protected]
 

Definition at line 84 of file ray.h.

Referenced by CastNext().


The documentation for this class was generated from the following files:
Generated on Thu Jan 30 21:35:44 2003 for 3DVis by doxygen1.3-rc2