Chronology Current Month Current Thread Current Date
[Year List] [Month List (current year)] [Date Index] [Thread Index] [Thread Prev] [Thread Next] [Date Prev] [Date Next]

Re: [Phys-L] Physics "applets" in HTML5/JavaScript



On 03/10/2013 10:02 AM, Daniel V. Schroeder asked about:

educational physics "applets" written in HTML5/JavaScript?

Here's one more, new as of a few minutes ago:
http://www.av8n.com/physics/js/equipotential-shells.html

It provides an interactive 3D view of the first ten equipotential
shells for the 1/r potential. One octant has been cut away so
that you can see inside.

I consider the 3D perspective to be useful. It provides a good
picture of what the potential is doing. I consider the applet
to be useful, because drawing such things by hand is a nightmare.
Also, interaction makes the view even more informative.

I did this by modifying some existing code ... some code that
I didn't write and don't even understand very well. I thought
this would be hard -- i.e. it would require understanding the
code -- but I got lucky. I just kludged a few lines and voilà!

It would be nice to have a toolkit for doing such things in
a non-kludgey way. Maybe someday.....

==============

While we are on the subject: Writing in javascript is infuriating.
It reminds me of writing in assembly language. I've done my fair
share of that, and I don't want to do any more. It's not a good
use of my time.

I would rather have an industrial-strength programming environment.
Something like C++. I reckon C++ is to javascript as chain-saw
is to butter-knife.

It turns out there is a long list of higher-level languages that
can be compiled to javascript:
https://github.com/jashkenas/coffee-script/wiki/List-of-languages-that-compile-to-JS

One option is to combine Clang with Emscripten, resulting in a
free, open-source compiler that takes in C++ and emits javascript.
It even claims to support webGL:
https://github.com/kripken/emscripten/wiki/OpenGL-support
Also, there appears to be some sort of game engine / graphics
library that sits on top of webGL. Some impressive-looking
demos can be found at
https://developer.mozilla.org/en-US/demos/detail/bananabread

I haven't had a chance to dig into this. If anybody has any
recommendations, cautionary tales, etc., please let me know.