layout.hpp
//Constructor - takes a vector of bodies initialized on the
//js side
takes a vector of bodies initialized on the
js side
takes a vector of bodies initialized on the js side
Layout(std::vector<Body> initBodies,
           std::vector<Spring> initSprings,
           float gravity,
           float theta,
           float dragCoeff,
           float timestep) : qt()
    {
        for(auto b: initBodies){
            bodies[b.id] = new Body(b);
            bodyList.push_back(b.id);
        }
        for(auto s: initSprings){
            springs[s.id] = new Spring(s);
        }
        updateBounds();
        this->gravity = gravity;
        this->theta = theta;
        this->dragCoeff = dragCoeff;
        this->timestep = timestep;
        for(int i = 0; i < 4; i++){
            workers.push_back(new ThreadRunner<Layout>(this));
        }
    }
Layout ( std :: vector < Body > initBodies , std :: vector < Spring > initSprings , float gravity , float theta , float dragCoeff , float timestep ) : qt ( ) { for ( auto b : initBodies ) { bodies [ b . id ] = new Body ( b ) ; bodyList . push_back ( b . id ) ; } for ( auto s : initSprings ) { springs [ s . id ] = new Spring ( s ) ; } updateBounds ( ) ; this -> gravity = gravity ; this -> theta = theta ; this -> dragCoeff = dragCoeff ; this -> timestep = timestep ; for ( int i = 0 ; i < 4 ; i ++ ) { workers . push_back ( new ThreadRunner < Layout > ( this ) ) ; } }
Constructor - takes a vector of bodies initialized on the
js side
Constructor - takes a vector of bodies initialized on the js side
//These bodies are set up on the js side and then passed in