phetsims / masses-and-springs

"Masses and Springs" is an educational simulation in HTML5, by PhET Interactive Simulations.
GNU General Public License v3.0
4 stars 5 forks source link

Range mismatch in Spring #340

Closed samreid closed 5 years ago

samreid commented 5 years ago

During https://github.com/phetsims/dot/issues/79 I noticed this code:

    // @public {Property.<number>} spring constant of spring
    this.springConstantProperty = new NumberProperty( MassesAndSpringsConstants.SPRING_CONSTANT_RANGE.defaultValue, {
      tandem: tandem.createTandem( 'springConstantProperty' ),
      units: 'newtons/meters',
      range: new Range( Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY )
    } );

Is it intentional that the springConstant specifies a different Range than SPRING_CONSTANT_RANGE? If not, we should use range: MassesAndSpringsConstants.SPRING_CONSTANT_RANGE. If so, the discrepancy should be documented.

Denz1994 commented 5 years ago

I have updated the range. Using the constant value is will suffice. Good catch. Closing.