void simulator::process() { for (it = bodies.begin(); it < bodies.end(); it++) { (*it)->coll = false; (*it)->col_edge = 0; } for (it = bodies.begin(); it < bodies.end(); it++) { (*it)->addimpulse((*it)->centre_g, grav, (*it)->mass*9.8); (*it)->ishighlited = false; for (it2 = bodies.begin(); it2 < bodies.end(); it2++) if (it != it2) (*it)->check_coll(*it2); (*it)->process(); } UI->body_at_cursor = BodyAtPos((UI->mouse_pos.x), (UI->mouse_pos.y)); }
void simulator::process() { energy = 0; for (it = bodies.begin(); it < bodies.end(); ++it) { (*it)->coll = false; (*it)->col_edge = 0; (*it)->addimpulse((*it)->centre_g, grav, (*it)->mass*10); } for (it = bodies.begin(); it < bodies.end(); ++it) { (*it)->ishighlited = false; for (it2 = bodies.begin(); it2 < bodies.end(); ++it2) if (it != it2) (*it)->check_coll(*it2); } for (it = bodies.begin(); it < bodies.end(); ++it) { (*it)->process(); energy += (*it)->vel.length()*(*it)->vel.length() * (*it)->mass; energy += (*it)->ang_vel*(*it)->ang_vel * (*it)->I; } UI->body_at_cursor = BodyAtPos(UI->mouse_pos); }