double velocity = initialVelocity - mu*G*time;
// Update the position of the disk.
xLocation = initialVelocity*time - 0.5*mu*G*time*time;
// Update the display
updateDisplay();
// If the disk stops moving or if it reaches
// the end of the board, stop the simulation
if ( velocity <= 0.0 || xLocation > 2.9) {
gameTimer.stop();
}
}
}
10.2.2.3 Centripetal Force
10.3 The Relationship Between Force, Acceleration, Velocity,
and Location
10.3.1 Solving the Translational Equations of Motion
10.3.2 Beanbag Game
// This ActionListener is called by the Timer
class GameUpdater implements ActionListener {
public void actionPerformed(ActionEvent event) {
// Update the time and compute the new position
// of the beanbag.
double timeIncrement = 0.05;
time += timeIncrement;
// There is no force in the x-direction, so the
// new x location is the initial x location plus
// the product of the horizontal velocity and time.
Chia sẻ với bạn bè của bạn: |