phetsims / wave-on-a-string

"Wave on a String" is an educational simulation in HTML5, by PhET Interactive Simulations.
http://phet.colorado.edu/en/simulation/wave-on-a-string
GNU General Public License v3.0
7 stars 8 forks source link

Oscillation creates angle discrepancy when wrapping over 2pi #17

Closed jonathanolson closed 10 years ago

jonathanolson commented 10 years ago

This is created almost every time the oscillator wraps around 2pi: woas-wrapping

As noted in the code:

if ( this.angle >= Math.PI * 2 ) {
  //REVIEW: shouldn't this be "this.angle %= Math.PI * 2"?
  this.angle = Math.PI * 2 * this.frequency * dt * this.speed;
}