phetsims / charges-and-fields

"Charges And Fields" is an educational simulation in HTML5, by PhET Interactive Simulations.
GNU General Public License v3.0
9 stars 7 forks source link

Redraw equipotential lines instead of deleting them #197

Open Finnventor opened 1 year ago

Finnventor commented 1 year ago

https://github.com/phetsims/charges-and-fields/blob/3d4ecf2a9133f9216ae4dc951353371ec9ffd631/js/charges-and-fields/model/ChargesAndFieldsModel.js#L246-L247 Electric potential lines are deleted every time a particle is moved. I think it would be helpful if instead the line was instead redrawn (as if the equipotential tool was used to make it again) from the location of the original click (which seems to already be stored somewhere for use as the position for the voltage label). Thanks!

veillette commented 1 year ago

Thanks @Finnventor for logging this issue.

We attempted to keep all the equipotential lines present when moving the charges but that proved to be a very difficult problem technically. For a say 5V equipotential line, the displacement of a charge may cause the equipotential line to move, bifurcate, disappear, or reappear somewhere else. So it is in difficult to know where to draw such a line without probing the entire plane. It was computationally difficult process without requiring webgl.

The solution proposed by @Finnventor gets around this difficulty by storing the points . The drawback of this approach is that the potential at the said point will change as the charge moves, so that even though the lines are equipotential in space they are not equipotential in time.

Technically, this approach is much easier to implement but it may be pedagogically misleading. In cases where the values checkbox is off, an identical set of equipotential lines would move differently depending on the initial point that was clicked.

For the cases where the values is check on, a student would find that the value attached to a particular equipotential would change as a charge is moved. A student may question what is constant in an equipotential after all?

I think we may have to test this feature with students to see if it is more beneficial than harmful.

Finnventor commented 1 year ago

Thanks, those are some very good points (no pun intended). Is it feasible to (every time a charge is moved) search for the closest point that has the same potential as the one where the equipotential line was started, and then to use that new point to create a new equipotential line to replace the old one? If no point is found nearby, the line would just be deleted, and if the line splits this would only catch one part of it. I think redrawing it like this would still help with forming intuition about equipotentials in most situations, though.

Alternatively, what if the equipotential starting points were saved behind the scenes before the lines were deleted, and there could be a button "Recalculate Equipotentials at Original Positions" or similar? This would make it easier to undo a charge being accidentally moved by a small amount which caused all equipotentials to disappear (although now as I write this, a general undo function could be a way to do the same thing in a way that's more intuitive to use, though would probably be a lot more complex to implement).