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

Use modelViewTransform instead of metersToPixels function #78

Closed aaronsamuel137 closed 9 years ago

aaronsamuel137 commented 9 years ago

During code review #56, we noticed two different kinds of transforms:

    // model coordinates are the same as view coordinates
    var modelViewTransform = ModelViewTransform2.createIdentity();

And

    // 1 meter is equal to 175 pixels
    metersToPixels: new LinearFunction( 0, 1, 0, 175 ),

It looks like the model coordinates should be in meters and the view coordinates are in "pixels". It would make more sense here to have a model view transform that goes from meters to pixels instead of passing around a function "metersToPixels". Can the metersToPixels function be removed and the modelViewTransform go from meters to screen coordinates?

andrey-zelenkov commented 9 years ago

Replace metersToPixels function by modelViewTransform. Reassign to @aaronsamuel137 for verification.

aaronsamuel137 commented 9 years ago

Looks much better, thanks! Closing