#include <ray.h>
Inheritance diagram for MaxIntensityTRI:
Public Methods | |
MaxIntensityTRI () | |
~MaxIntensityTRI () | |
bool | CastNext () |
|
Definition at line 109 of file ray.h.
00109 {}; |
|
Definition at line 110 of file ray.h.
00110 {}; |
|
Reimplemented from FirstHitTRI. Definition at line 439 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.
00439 { 00440 if(m_data == NULL) return false; 00441 if(m_tf == NULL) return false; 00442 int maxintensity = 0; 00443 int step_count = 0; 00444 VECTOR distancetomidpoint = VECTOR(mx/2.0f,my/2.0f,mz/2.0f)-m_currentpos; 00445 int steps = (int)((distancetomidpoint.length() + m_radius)/m_steplength); 00446 bool first = true; 00447 do { 00448 00449 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)) { 00450 if(first) { 00451 m_startpoint = VECTOR(m_currentpos.x,m_currentpos.y,m_currentpos.z); 00452 first = false; 00453 } 00454 float d = GetDensity(m_currentpos); 00455 if(d > (float)maxintensity) { 00456 maxintensity = d; 00457 } 00458 // calculate new position 00459 } 00460 m_currentpos += m_steplength*m_direction; 00461 step_count++; 00462 }while(step_count <= steps); 00463 00464 m_currentcolor = m_tf->GetDensityColor(maxintensity); 00465 m_alpha = m_tf->GetOpacity(maxintensity); 00466 if(maxintensity == 0) { 00467 m_currentcolor = Color(0,0,0); 00468 m_alpha = 1.0; 00469 } 00470 if(m_alpha < 1.0 ) { 00471 m_currentcolor += m_backgroundcolor*(1.0f-m_alpha); 00472 } 00473 return true; 00474 } |