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

XRayTRI Class Reference

#include <ray.h>

Inheritance diagram for XRayTRI:

FirstHitTRI Trilinear Ray List of all members.

Public Methods

 XRayTRI ()
 ~XRayTRI ()
bool CastNext ()

Constructor & Destructor Documentation

XRayTRI::XRayTRI   [inline]
 

Definition at line 123 of file ray.h.

00123 {};

XRayTRI::~XRayTRI   [inline]
 

Definition at line 124 of file ray.h.

00124 {};


Member Function Documentation

bool XRayTRI::CastNext   [virtual]
 

Reimplemented from FirstHitTRI.

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

00511                   {
00512         if(m_data == NULL) return false;
00513         if(m_tf == NULL) return false;
00514         int density = 0;
00515         int step_count = 0;
00516         VECTOR distancetomidpoint = VECTOR(mx/2.0f,my/2.0f,mz/2.0f)-m_currentpos;
00517         int steps = (int)((distancetomidpoint.length() + m_radius)/m_steplength);
00518         bool first = true;
00519         do {
00520                 
00521                 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)) {
00522                         if(first) {
00523                                 m_startpoint = VECTOR(m_currentpos.x,m_currentpos.y,m_currentpos.z);
00524                                 first = false;
00525                         }
00526                         float d = GetDensity(m_currentpos);
00527                         density += d*m_steplength; 
00528                         // calculate new position
00529                 }
00530                 m_currentpos += m_steplength*m_direction;
00531                 step_count++;
00532         }while(step_count <= steps);
00533 
00534         m_currentcolor = m_tf->GetDensityColor(density);
00535         m_alpha = m_tf->GetOpacity(density);
00536         if(density == 0) {
00537                 m_currentcolor = Color(0,0,0);
00538                 m_alpha = 1.0;
00539         }
00540         if(m_alpha < 1.0 ) {
00541                 m_currentcolor += m_backgroundcolor*(1.0f-m_alpha);
00542         }
00543         return true;
00544 }


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