-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ModelViewTransform2.create* is called 10 times in this simulation #292
Comments
These 2 calls to
// @private - View width for one cell
this.cellWidth = ModelViewTransform2.createRectangleMapping( scene.lattice.visibleBounds, viewBounds )
.modelToViewDeltaX( 1 );
const cellWidth = ModelViewTransform2.createRectangleMapping( scene.lattice.visibleBounds, viewBounds )
.modelToViewDeltaX( 1 ); These look like the same transform, and the same The call in (CM: edited the above.) |
This call in const transform = ModelViewTransform2.createRectangleMapping( waterSceneLatticeBounds, waveAreaViewBounds ); Is it really necessary to compute a transform each time |
I'm planning to coalesce these. It appropriate to store them on the |
implementation-notes.md says:
There are 3 coordinate frames. What are the transform relationships? The names used in the code aren't very helpful -- I see |
Should I take a first pass at factoring these out, storing them in Scene.js after the view is created, then reassigning to you for review? |
|
Proposed fix committed, please review. |
Looks great, much clearer. Closing. |
Inspired by #264, I observed that
ModelViewTransform2.create*
is called 10 times in this simulation. Many of these are duplicates and it would be good to isolate them. It seems the appropriate place to track them is in each Scene. But the problem is at the moment Scene is "model only". Once the view is constructed and we know the wave area bounds, we could create the transforms and set them to the Scenes. This seems a plausible approach but I'm not sure whether it is optimal. @pixelzoom what do you recommend?The text was updated successfully, but these errors were encountered: