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

MaxIntensityNN Class Reference

#include <ray.h>

Inheritance diagram for MaxIntensityNN:

Ray List of all members.

Public Methods

 MaxIntensityNN ()
 ~MaxIntensityNN ()
bool CastNext ()

Constructor & Destructor Documentation

MaxIntensityNN::MaxIntensityNN   [inline]
 

Definition at line 100 of file ray.h.

00100 {};

MaxIntensityNN::~MaxIntensityNN   [inline]
 

Definition at line 101 of file ray.h.

00101 {};


Member Function Documentation

bool MaxIntensityNN::CastNext   [virtual]
 

Reimplemented from Ray.

Definition at line 402 of file ray.cpp.

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

00402                          {
00403         if(m_data == NULL) return false;
00404         if(m_tf == NULL) return false;
00405         int maxintensity = 0;
00406         int step_count = 0;
00407         bool first = true;
00408         VECTOR distancetomidpoint = VECTOR(mx/2.0f,my/2.0f,mz/2.0f)-m_currentpos;
00409         int steps = (int)((distancetomidpoint.length() + m_radius)/m_steplength);
00410         do {
00411                 
00412                 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)) {
00413                         if(first) {
00414                                 m_startpoint = VECTOR(m_currentpos.x,m_currentpos.y,m_currentpos.z);
00415                                 first = false;
00416                         }
00417                         int d = m_data->GetDensity((int)ROUND(m_currentpos.x),(int)ROUND(m_currentpos.y),(int)ROUND(m_currentpos.z));
00418                         if(d > maxintensity) {
00419                                 maxintensity = d;       
00420                         }
00421                 }
00422                 // calculate new position
00423                 m_currentpos += m_steplength*m_direction;
00424                 
00425                 step_count++;
00426         }while(step_count <= steps);
00427         m_light = false;
00428         m_currentcolor = m_tf->GetDensityColor(maxintensity);
00429         m_alpha = m_tf->GetOpacity(maxintensity);
00430         if(maxintensity == 0) {
00431                 m_currentcolor = Color(0,0,0);
00432                 m_alpha = 1.0;
00433         }
00434         if(m_alpha < 1.0 ) m_currentcolor += m_backgroundcolor*(1.0 - m_alpha);
00435         return true;
00436 }


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