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

FirstHitTRI Class Reference

#include <ray.h>

Inheritance diagram for FirstHitTRI:

Trilinear Ray MaxIntensityTRI XRayTRI List of all members.

Public Methods

 FirstHitTRI ()
bool SetTreshold (int treshold)
bool CastNext ()

Protected Methods

float GetDensity (VECTOR pos)

Protected Attributes

int m_treshold

Constructor & Destructor Documentation

FirstHitTRI::FirstHitTRI   [inline]
 

Definition at line 96 of file ray.h.

00096 {m_treshold = 0.0;};


Member Function Documentation

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

Reimplemented in MaxIntensityTRI, and XRayTRI.

Definition at line 397 of file ray.cpp.

References Trilinear::CalcAlphaTrilinear(), Trilinear::CalcColorTrilinear(), GetDensity(), VECTOR::length(), Trilinear::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, VECTOR::x, VECTOR::y, and VECTOR::z.

00397                       {
00398         
00399         if(m_data == NULL) return false;
00400         if(m_tf == NULL) return false;
00401         
00402         int step_count = 0;
00403         VECTOR distancetomidpoint = VECTOR(mx/2.0f,my/2.0f,mz/2.0f)-m_currentpos;
00404         int steps = (int)((distancetomidpoint.length() + m_radius)/m_steplength);
00405         bool first = true;
00406         do {
00407                 
00408                 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)) {
00409                         if(first) {
00410                                 m_startpoint = VECTOR(m_currentpos.x,m_currentpos.y,m_currentpos.z);
00411                                 first = false;
00412                         }
00413                         float d = GetDensity(m_currentpos);
00414                         if(d > (float)m_treshold) {
00415                                 Color help_color = CalcColorTrilinear(m_currentpos);
00416                                 float help_alpha = CalcAlphaTrilinear(m_currentpos);
00417                                 // lightning:
00418                                 help_color = Lighting(help_color);
00419                                 // calculate new currentcolor:
00420                                 m_currentcolor = help_color;
00421                                 // calculate new alphavalue
00422                                 m_alpha = help_alpha;
00423                                 break;
00424                         }
00425                         // calculate new position
00426                 }
00427                 m_currentpos += m_steplength*m_direction;
00428                 step_count++;
00429         }while(step_count <= steps);
00430         if(m_alpha < 1.0 ) {
00431                 m_currentcolor += m_backgroundcolor*(1.0f-m_alpha);
00432         }
00433         return true;
00434 }

float FirstHitTRI::GetDensity VECTOR    pos [protected]
 

berechnet dichtewert an einer Position im Volumen mit Hilfe trilinearer Interpolation

Definition at line 365 of file ray.cpp.

References Data::GetDensity(), Ray::m_data, VECTOR::x, VECTOR::y, and VECTOR::z.

Referenced by XRayTRI::CastNext(), MaxIntensityTRI::CastNext(), and CastNext().

00365                                   {
00366         int dat000 = m_data->GetDensity(floorf(pos.x),floorf(pos.y),floorf(pos.z));
00367         int dat001 = m_data->GetDensity(floorf(pos.x),floorf(pos.y),ceilf(pos.z));
00368         int dat010 = m_data->GetDensity(floorf(pos.x),ceilf(pos.y),floorf(pos.z));
00369         int dat011 = m_data->GetDensity(floorf(pos.x),ceilf(pos.y),ceilf(pos.z));
00370         int dat100 = m_data->GetDensity(ceilf(pos.x),floorf(pos.y),floorf(pos.z));
00371         int dat101 = m_data->GetDensity(ceilf(pos.x),floorf(pos.y),ceilf(pos.z));
00372         int dat110 = m_data->GetDensity(ceilf(pos.x),ceilf(pos.y),floorf(pos.z));
00373         int dat111 = m_data->GetDensity(ceilf(pos.x),ceilf(pos.y),ceilf(pos.z));
00374 
00375         float difX = abs(pos.x - floorf(pos.x));
00376         float difY = abs(pos.y - floorf(pos.y));
00377         float difZ = abs(pos.z - floorf(pos.z));
00378 
00379         int datA = dat000*difX + dat100*abs(1.0f-difX);
00380         int datB = dat010*difX + dat110*abs(1.0f-difX);
00381         int datC = dat011*difX + dat111*abs(1.0f-difX);
00382         int datD = dat001*difX + dat101*abs(1.0f-difX);
00383 
00384         int datE = datA*difZ + datD*abs(1.0f-difZ);
00385         int datF = datB*difZ + datC*abs(1.0f-difZ);
00386 
00387         int dat = datE*difY + datF*abs(1.0f-difY);
00388         return dat;
00389 }

bool FirstHitTRI::SetTreshold int    treshold [inline]
 

Definition at line 97 of file ray.h.

00097 { m_treshold = treshold; return true;};


Member Data Documentation

int FirstHitTRI::m_treshold [protected]
 

Definition at line 93 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