Variables #141
Replies: 9 comments
-
Do you mean to evaluate equations with named constants (which cannot be changed once evaluated) when entering the (x,y) coordinates of a control point? Or do you mean to fully parametrize the scene with a set of variables, so that you can adjust the variables and see the corresponding change? The former is relatively easy to implement, while the latter is very difficult. It would be helpful if you could describe in more details your specific need. Also note that some of the existing features, such as the handle (see the "Group, rotate, or scale object" section in the popup of the "Help" button), may provide some of the automation you need. For now, you may also consider using a Python script to generate the scene, as in https://phydemo.app/ray-optics/gallery/chaff-countermeasure. |
Beta Was this translation helpful? Give feedback.
-
My intention was the latter, however now that I've further reflected on my idea it was a bit lazy of me to request such a feature, especially with the fact that I do not know much about the subject of geometric optics, meaning my idea could be near useless whether it be from a lack of need or from the need already being satisfied by something else, I apologize for opening an issue on this and in the future I will put in more consideration before opening issues. |
Beta Was this translation helpful? Give feedback.
-
This is actually a good feature request, and you are not the first one to request this. Actually, at least 15 items in the Gallery would be benefitted by this feature, and I have considered it seriously before. The only problem is that the implementation is highly nontrivial, and there are several very different possible approaches, such that once decided, it will be impractical to change to another. I need to know that what the users need in order to decide which approach is the best, so it is still a good idea if you can provide your original thought. Note that this app is designed for educational purpose, so suggestions from people who do not know much about geometric optics is also valuable (compare https://www.desmos.com/, an educational-purpose graphing calculator in which almost everything is parametrizable). Also, I will keep this issue open for discussion, since there have been other people suggesting this privately before. Note that, however, this feature is not expected to be implemented in the near future due to its difficulty. |
Beta Was this translation helpful? Give feedback.
-
Thanks for reopening it. It can also come in handy to me. |
Beta Was this translation helpful? Give feedback.
-
Depending on the shape of the dimples, it looks like this automation you are describing may be possible with the handle (the "Group, rotate, or scale object" section in the popup of the "Help" button), such as clicking all the tip points of the dimples, and then move it with the handle. Still, in the general case, the parametrization/variable feature is still required. And actually also I am thinking about the "list" feature which should work together with the variable feature, so that you don't even need to replicate that a lot of things in the beginning, and the number of replication is also an adjustable variable. In Desmos, it is very simple to achieve this. And I have been considering to implement this also in ray-optics. But that is the most difficult part. There are actually relatively simple (but still quite difficult) approaches to implement the "variable", but then it will not allow the implementation of "list". My current thought is to use an approach that will allow these two features together. |
Beta Was this translation helpful? Give feedback.
-
Also, the main difficulty to implement this is to create the proper user interface. If you don't need a full user interface (such as you need to first edit the scene by editing the JSON code directly, but then the variables can still be adjusted in UI with sliders, and non-parametrized object can be created and edited in the UI as usual), then it is actually not that difficult, and may be done in the near future. But without the full UI, I do not know how many people would be benefitted by this. I do not know what fraction of the users of this app is comfortable editing JSON code directly. |
Beta Was this translation helpful? Give feedback.
-
Recently, similar feature requests has been suggested two more times from private emails. One of the suggestion is to use a desmos-like equation sidebar approach, where the user can add objects by typing an equation, such as C_1 = glass(circle[p, r],gradient[f(x), o]) to create a glass gradient index circle with boundary origin p, radius r, and absolute origin o. This has a relatively simple implementation without the need to modify a lot of core code (as opposed to previously-proposed approach). We just need to treat the list of equations as a "scene-builder" outside of the existing scene editor UI, and every time the user modifies some variables or equations are modified, just "recompile" those variable/equations into the JSON object of the scene in the original format readable by the core simulator. Also, we do not need to implement all the possible features (as equations) at once, as one can still add objects in the old way in the editor (without appearing in the sidebar). |
Beta Was this translation helpful? Give feedback.
-
See also #142 |
Beta Was this translation helpful? Give feedback.
-
I added a minimal implementation of this in the See the announcement at #145. |
Beta Was this translation helpful? Give feedback.
-
I feel as though a simple way to reference variables when inputting coordinates to make inputting repeating values or related values easier and faster, and I imagine easy to implement.
Beta Was this translation helpful? Give feedback.
All reactions