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

XRayNN Class Reference

#include <ray.h>

Inheritance diagram for XRayNN:

Ray List of all members.

Public Methods

 XRayNN ()
 ~XRayNN ()
bool CastNext ()

Constructor & Destructor Documentation

XRayNN::XRayNN   [inline]
 

Definition at line 120 of file ray.h.

00120 {};

XRayNN::~XRayNN   [inline]
 

Definition at line 121 of file ray.h.

00121 {};


Member Function Documentation

bool XRayNN::CastNext   [virtual]
 

berechnet den farbwert eines Strahls indem er das Volumen an diskreten Punkten abtastet, dort einen Dichtewert erhält, und diesen dichtewert in eine Farbe umwandelt und dann im Volumen vorwärts geht bis das Ende des Volumens erreicht ist oder die Opazität eins ist

Reimplemented from Ray.

Definition at line 526 of file ray.cpp.

References Data::GetDensity(), VECTOR::length(), Ray::m_alpha, Ray::m_currentcolor, Ray::m_currentpos, Ray::m_data, Ray::m_direction, Ray::m_maxDens, Ray::m_minDens, 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.

00526                  {
00527         if(m_data == NULL) return false;
00528         if(m_tf == NULL) return false;
00529         int density = 0;
00530         int step_count = 0;
00531         bool first = true;
00532         int counter = 0;
00533 
00534         VECTOR distancetomidpoint = VECTOR(mx/2.0f,my/2.0f,mz/2.0f) - m_currentpos;
00535         int steps = (int)((distancetomidpoint.length() + m_radius)/m_steplength);
00536         do {
00537                 
00538                 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)) {
00539                         if(first) {
00540                                 m_startpoint = VECTOR(m_currentpos.x,m_currentpos.y,m_currentpos.z);
00541                                 first = false;
00542                         }
00543                         int d = m_data->GetDensity((int)ROUND(m_currentpos.x),(int)ROUND(m_currentpos.y),(int)ROUND(m_currentpos.z));
00544                         density += d;
00545                         counter++;
00546                 }
00547                 // calculate new position
00548                 m_currentpos += m_steplength*m_direction;
00549                 
00550                 step_count++;
00551         }while(step_count <= steps);
00552 
00553         
00554         float colormodifyer = (float) ((m_maxDens - m_minDens - 1) / 255);      
00555         
00556         if (colormodifyer > 0)
00557                 colormodifyer = 1.0f / colormodifyer;
00558 
00559         if (counter <= 0)
00560                 m_currentcolor = Color(0, 0, 0);
00561         else {
00562                 unsigned char col = (unsigned char) ((density / counter) * colormodifyer);
00563                 m_currentcolor = Color(col, col, col);
00564         }
00565 
00566         m_alpha = 1.0f;
00567 
00568         return true;
00569 }


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