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 104 of file ray.h.

00104 {};

MaxIntensityNN::~MaxIntensityNN   [inline]
 

Definition at line 105 of file ray.h.

00105 {};


Member Function Documentation

bool MaxIntensityNN::CastNext   [virtual]
 

berechnet den farbwert eines Strahls indem er das Volumen an diskreten Punkten abtastet, dort einen Dichtewert erhält und den Dichtewert sucht, der die größte Opazität liefert. Für diesen Dichtewert wird die Farbe des Strahls berechnet

Reimplemented from Ray.

Definition at line 441 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.

00441                          {
00442         if(m_data == NULL) return false;
00443         if(m_tf == NULL) return false;
00444         int maxdens = 0;
00445         float maxintens = 0.0f;
00446         int step_count = 0;
00447         bool first = true;
00448         VECTOR distancetomidpoint = VECTOR(mx/2.0f,my/2.0f,mz/2.0f)-m_currentpos;
00449         int steps = (int)((distancetomidpoint.length() + m_radius)/m_steplength);
00450         do {
00451                 
00452                 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)) {
00453                         if(first) {
00454                                 m_startpoint = VECTOR(m_currentpos.x,m_currentpos.y,m_currentpos.z);
00455                                 first = false;
00456                         }
00457                         int d = m_data->GetDensity((int)ROUND(m_currentpos.x),(int)ROUND(m_currentpos.y),(int)ROUND(m_currentpos.z));
00458                         float intens = m_tf->GetOpacity(d);
00459                         if(intens > maxintens) {
00460                                 maxintens = intens;
00461                                 maxdens = d;
00462                         }
00463                 }
00464                 // calculate new position
00465                 m_currentpos += m_steplength*m_direction;
00466                 
00467                 step_count++;
00468         }while(step_count <= steps);
00469         m_light = false;
00470         m_currentcolor = m_tf->GetDensityColor(maxdens);
00471         m_alpha = maxintens;
00472         if(maxdens == 0) {
00473                 m_currentcolor = Color(0,0,0);
00474                 m_alpha = 1.0;
00475         }
00476         if(m_alpha < 1.0 ) m_currentcolor += m_backgroundcolor*(1.0 - m_alpha);
00477         return true;
00478 }


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