void LaserCooledIon::velocity_scale(double dt) { // Note that this routine is called with dt/2, so use // of "dt" referring to the complete timestep requires // multiplication by 2. // double two_dt = 2.0*dt; // Eqn. 3.6, undo friction term Vector3D friction = get_friction(); this->Ion::kick(dt, friction); // Eqn. 3.7 // vel_.z /= 1.0 + two_dt*dt*ionType_.beta/ionType_.mass; vel_.z /= 1.0 + dt*ionType_.beta/ionType_.mass; }
void slow_droite(map &map, player &pl) { int friction; friction = get_friction(map, pl); if (ok(map, pl)) { if (pl._v.x > 0) pl._v.x -= 0.001 * friction; } else { pl._v.x = 0; } }
void slow_gauche(map &map, player &pl) { int friction; int cx, cy; cx = pl._pos.x / 32; cy = (pl._pos.y + 32) / 32; friction = get_friction(map, pl); if (ok(map, pl)) { if (pl._v.x < 0) pl._v.x += 0.001 * friction; } else { pl._v.x = 0; } }