phetsims / pendulum-lab

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

The simulation should make use of the modelViewTransform2 to go from the model to the view. #19

Closed veillette closed 9 years ago

veillette commented 9 years ago

Currently the simulation pays lip service to the modelViewTransform. Although it is used throughout the simulation it is set to unity.

In pendulumLabModel.js, one finds

metersToPixels: new LinearFunction( 0, 1, 0, 175 )

it would be preferable to define a modelViewTransform of the form

modelViewTransform= new ModelViewTransform2.createOffsetScaleMapping( new Vector2(0,0), 175)

in this way the modelViewTransform.viewToModelDeltaX can replace the invocation of the metersToPixels function

For the MovableDragHandler, if the location and the dragbounds are in view coordinates, one can create a modelViewTransform that is equal to ModelViewTransform2.createIdentity() just for this purpose.

veillette commented 9 years ago

The decision was made at the dev meeting to relax this stipulation for the pendulumLab. so closing