bool StreamlineBase::isTerminatedByVectorLength( const kvs::Vec3& vector ) { if ( m_enable_vector_length_condition ) { return vector.length() < m_vector_length_threshold; } return false; }
/*===========================================================================*/ const kvs::RGBColor Streamline::calculate_color( const kvs::Vec3& direction ) { const kvs::Real64 min_length = BaseClass::volume()->minValue(); const kvs::Real64 max_length = BaseClass::volume()->maxValue(); const kvs::Real64 diff = direction.length() - min_length; const kvs::Real64 interval = max_length - min_length; const kvs::UInt8 level = kvs::UInt8( 255.0 * diff / interval ); return BaseClass::transferFunction().colorMap()[level]; }
kvs::Vec3 PrismCell::globalToLocal( const kvs::Vec3 point ) { const kvs::Vec3 X( point ); const float TinyValue = static_cast<float>( 1.e-6 ); const size_t MaxLoop = 100; kvs::Vec3 x0( 0.3f, 0.3f, 0.5f ); for ( size_t i = 0; i < MaxLoop; i++ ) { this->setLocalPoint( x0 ); const kvs::Vec3 X0( this->localToGlobal( x0 ) ); const kvs::Vec3 dX( X - X0 ); const kvs::Mat3 J( this->JacobiMatrix() ); const kvs::Vec3 dx = J.transposed().inverted() * dX; if ( dx.length() < TinyValue ) break; // Converged. x0 += dx; } return x0; }
/*===========================================================================*/ const kvs::Vec3 CellBase::globalToLocal( const kvs::Vec3& global ) const { const kvs::Vec3 X( global ); // Calculate the coordinate of 'global' in the local coordinate // by using Newton-Raphson method. const float TinyValue = static_cast<float>( 1.e-6 ); const size_t MaxLoop = 100; kvs::Vec3 x0( 0.25f, 0.25f, 0.25f ); // Initial point in local coordinate. for ( size_t i = 0; i < MaxLoop; i++ ) { const kvs::Vec3 X0( this->localToGlobal( x0 ) ); const kvs::Vec3 dX( X - X0 ); const kvs::Mat3 J( this->JacobiMatrix() ); const kvs::Vec3 dx = J.transposed().inverted() * dX; if ( dx.length() < TinyValue ) break; // Converged. x0 += dx; } return x0; }
kvs::RGBColor StreamlineBase::interpolatedColor( const kvs::Vec3& value ) { return BaseClass::transferFunction().colorMap().at( value.length() ); }
/*===========================================================================*/ bool StreamlineBase::check_for_vector_length( const kvs::Vec3& direction ) { return direction.length() < m_vector_length_threshold; }