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

MaxIntensityTRI Class Reference

#include <ray.h>

Inheritance diagram for MaxIntensityTRI:

FirstHitTRI Trilinear Ray List of all members.

Public Methods

 MaxIntensityTRI ()
 ~MaxIntensityTRI ()
bool CastNext ()

Constructor & Destructor Documentation

MaxIntensityTRI::MaxIntensityTRI   [inline]
 

Definition at line 113 of file ray.h.

00113 {};

MaxIntensityTRI::~MaxIntensityTRI   [inline]
 

Definition at line 114 of file ray.h.

00114 {};


Member Function Documentation

bool MaxIntensityTRI::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 FirstHitTRI.

Definition at line 485 of file ray.cpp.

References FirstHitTRI::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_radius, Ray::m_startpoint, Ray::m_steplength, Ray::m_tf, Ray::mx, Ray::my, Ray::mz, VECTOR::x, VECTOR::y, and VECTOR::z.

00485                           {
00486         if(m_data == NULL) return false;
00487         if(m_tf == NULL) return false;
00488         float maxintensity = 0.0f;
00489         int maxdens = 0;
00490         int step_count = 0;
00491         VECTOR distancetomidpoint = VECTOR(mx/2.0f,my/2.0f,mz/2.0f)-m_currentpos;
00492         int steps = (int)((distancetomidpoint.length() + m_radius)/m_steplength);
00493         bool first = true;
00494         do {
00495                 
00496                 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)) {
00497                         if(first) {
00498                                 m_startpoint = VECTOR(m_currentpos.x,m_currentpos.y,m_currentpos.z);
00499                                 first = false;
00500                         }
00501                         float d = GetDensity(m_currentpos);
00502                         float intens = m_tf->GetOpacity((int)d);        
00503                         if(intens > maxintensity) {
00504                                 maxintensity = intens;
00505                                 maxdens = d;
00506                         }
00507                         // calculate new position
00508                 }
00509                 m_currentpos += m_steplength*m_direction;
00510                 step_count++;
00511         }while(step_count <= steps);
00512 
00513         m_currentcolor = m_tf->GetDensityColor(maxdens);
00514         m_alpha = maxintensity;
00515         if(maxdens == 0) {
00516                 m_currentcolor = Color(0,0,0);
00517                 m_alpha = 1.0;
00518         }
00519         if(m_alpha < 1.0 ) {
00520                 m_currentcolor += m_backgroundcolor*(1.0f-m_alpha);
00521         }
00522         return true;
00523 }


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