Renderer::Renderer(int x, int y, int w, int h, const char *label) : Fl_Gl_Window(x, y, w, h, label) , ground_tex(0) , ground_tex2(0) , client_(0) { eye[0] = 0; eye[1] = -100; eye[2] = 100; center[0] = 0; center[1] = 0; center[2] = 0; double left[3] = { -1, 0, 0 }; double cam_dir[3]; substract_vector(cam_dir, center, eye); cross_product(up, cam_dir, left); }
void gram_schmidt( StateType &x , LyapType &lyap , size_t n ) { if( !num_of_lyap ) return; if( ptrdiff_t( ( num_of_lyap + 1 ) * n ) != std::distance( x.begin() , x.end() ) ) throw std::domain_error( "renormalization() : size of state does not match the number of lyapunov exponents." ); typedef typename StateType::value_type value_type; typedef typename StateType::iterator iterator; value_type norm[num_of_lyap]; value_type tmp[num_of_lyap]; iterator first = x.begin() + n; iterator beg1 = first , end1 = first + n ; std::fill( norm , norm+num_of_lyap , 0.0 ); // normalize first vector norm[0] = sqrt( std::inner_product( beg1 , end1 , beg1 , 0.0 ) ); normalize( beg1 , end1 , norm[0] ); beg1 += n; end1 += n; for( size_t j=1 ; j<num_of_lyap ; ++j , beg1+=n , end1+=n ) { for( size_t k=0 ; k<j ; ++k ) { tmp[k] = std::inner_product( beg1 , end1 , first + k*n , 0.0 ); // clog << j << " " << k << " " << tmp[k] << "\n"; } for( size_t k=0 ; k<j ; ++k ) substract_vector( beg1 , end1 , first + k*n , tmp[k] ); // normalize j-th vector norm[j] = sqrt( std::inner_product( beg1 , end1 , beg1 , 0.0 ) ); // clog << j << " " << norm[j] << "\n"; normalize( beg1 , end1 , norm[j] ); } for( size_t j=0 ; j<num_of_lyap ; j++ ) lyap[j] += log( norm[j] ); }