void System::computeGravitation() { for( size_t i = 0; i < _nBodies; ++i ) { Vector3f acc{ 0.0f, 0.0f, 0.0f }; for( size_t j = 0; j < _nBodies; ++j ) { if( i != j ) { interactBodies( i, j, _softFactor, acc ); } } _body[i].accel() = acc; } }
void Integrator::computeAccel( tBodyVec& bodies ) { for ( size_t i = 0; i < bodies.size(); ++i) { bodies[i].accel() = Vector3d{0.0, 0.0, 0.0}; } for( size_t i = 0; i < bodies.size(); ++i ) { for( size_t j = 0; j < bodies.size(); ++j ) { if( i != j ) { interactBodies( bodies, i, j, _softFactor ); } } } }