#include <ray.h>
Inheritance diagram for XRayNN:

Public Methods | |
| XRayNN () | |
| ~XRayNN () | |
| bool | CastNext () |
|
|
Definition at line 116 of file ray.h.
00116 {};
|
|
|
Definition at line 117 of file ray.h.
00117 {};
|
|
|
Reimplemented from Ray. Definition at line 477 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_radius, Ray::m_startpoint, Ray::m_steplength, Ray::m_tf, Ray::mx, Ray::my, Ray::mz, ROUND, VECTOR::x, VECTOR::y, and VECTOR::z.
00477 {
00478 if(m_data == NULL) return false;
00479 if(m_tf == NULL) return false;
00480 int density = 0;
00481 int step_count = 0;
00482 bool first = true;
00483 VECTOR distancetomidpoint = VECTOR(mx/2.0f,my/2.0f,mz/2.0f)-m_currentpos;
00484 int steps = (int)((distancetomidpoint.length() + m_radius)/m_steplength);
00485 do {
00486
00487 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)) {
00488 if(first) {
00489 m_startpoint = VECTOR(m_currentpos.x,m_currentpos.y,m_currentpos.z);
00490 first = false;
00491 }
00492 int d = m_data->GetDensity((int)ROUND(m_currentpos.x),(int)ROUND(m_currentpos.y),(int)ROUND(m_currentpos.z));
00493 density += d*m_steplength;
00494 }
00495 // calculate new position
00496 m_currentpos += m_steplength*m_direction;
00497
00498 step_count++;
00499 }while(step_count <= steps);
00500 m_currentcolor = m_tf->GetDensityColor(density);
00501 m_alpha = m_tf->GetOpacity(density);
00502 if(density == 0) {
00503 m_currentcolor = Color(0,0,0);
00504 m_alpha = 1.0;
00505 }
00506 if(m_alpha < 1.0 ) m_currentcolor += m_backgroundcolor*(1.0 - m_alpha);
00507 return true;
00508 }
|
1.3-rc2