#include <ray.h>
Inheritance diagram for XRayTRI:
Public Methods | |
XRayTRI () | |
~XRayTRI () | |
bool | CastNext () |
|
Definition at line 127 of file ray.h.
00127 {}; |
|
Definition at line 128 of file ray.h.
00128 {}; |
|
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 FirstHitTRI. Definition at line 572 of file ray.cpp. References FirstHitTRI::GetDensity(), VECTOR::length(), 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, VECTOR::x, VECTOR::y, and VECTOR::z.
00572 { 00573 if(m_data == NULL) return false; 00574 if(m_tf == NULL) return false; 00575 int density = 0; 00576 int step_count = 0; 00577 VECTOR distancetomidpoint = VECTOR(mx/2.0f,my/2.0f,mz/2.0f)-m_currentpos; 00578 int steps = (int)((distancetomidpoint.length() + m_radius)/m_steplength); 00579 bool first = true; 00580 int counter = 0; 00581 00582 do { 00583 00584 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)) { 00585 if(first) { 00586 m_startpoint = VECTOR(m_currentpos.x,m_currentpos.y,m_currentpos.z); 00587 first = false; 00588 } 00589 float d = GetDensity(m_currentpos); 00590 density += d/* * m_steplength*/; 00591 counter++; 00592 // density += d*m_steplength; 00593 // calculate new position 00594 } 00595 m_currentpos += m_steplength*m_direction; 00596 step_count++; 00597 }while(step_count <= steps); 00598 00599 float colormodifyer = (float) ((m_maxDens - m_minDens - 1) / 255); 00600 00601 if (colormodifyer > 0) 00602 colormodifyer = 1.0f / colormodifyer; 00603 00604 if (counter <= 0) 00605 m_currentcolor = Color(0, 0, 0); 00606 else { 00607 unsigned char col = (unsigned char) ((density / counter) * colormodifyer); 00608 m_currentcolor = Color(col, col, col); 00609 } 00610 00611 /* 00612 m_currentcolor = m_tf->GetDensityColor(density); 00613 m_alpha = m_tf->GetOpacity(density); 00614 if(density == 0) { 00615 m_currentcolor = Color(0,0,0); 00616 m_alpha = 1.0; 00617 } 00618 if(m_alpha < 1.0 ) { 00619 m_currentcolor += m_backgroundcolor*(1.0f-m_alpha); 00620 } 00621 */ 00622 return true; 00623 } |