phetsims / collision-lab

"Collision Lab" is an educational simulation in HTML5, by PhET Interactive Simulations.
GNU General Public License v3.0
6 stars 4 forks source link

The momentum of the ball should be a Vector2 #20

Closed veillette closed 5 years ago

veillette commented 5 years ago

Currently we have

    /**
     * Gets the linear momentum of this ball.
     * @returns {number} - Kg * (m/s)
     * @public
     */
    get momentum() {
      return this.mass * this.velocity.magnitude; // Momentum = m * v
    }

Rather the momentum should be a vector quantity

/**
 * Gets the linear momentum of this ball.
 * @returns {number} - Kg * (m/s)
 * @public
 */
get momentum() {
  return this.mass * this.velocity // Momentum = m * v
}
veillette commented 5 years ago

The magnitude of the momentum can be accessed in the usual way since momentum is a Vector2