APS Excellence in Physics Education Award
November 2019

Education Prize Logo
Science SPORE Prize
November 2011

NSF Logo
The Open Source Physics Project is supported by NSF DUE-0442581.

Convert 2D simulation to 3D post and replies

Return to the Convert 2D simulation to 3D thread
Login to post to this thread

Convert 2D simulation to 3D
George Barouxis
8 Posts

Hi,

I am trying to convert a fairly complex 2D simulation with 110 elements (lines, rays, ellipses, etc.) to 3D. I opened the ejss file in Notepad++ and replaced the 2D plotting panel with a drawingpanel3D, segment2D with segment3D, shape2D with sphere3D, etc.

Ejss was able to read the file and I opened some of the elements and their properties looked OK (minimuX, maximumX, etc.), but when I loaded the simulation in the html page I will use, I got a "parent.GetClass is not a function" error.

Any ideas what is going on? Is it due to the replacements and the fact that some 2D and 3D elements have different properties or is something else the matter?

If the former, is there any other way of doing this except for building the 3D simulation from scratch?

I am using JavaScript_Ejs_6.01 with jre1.8.0_331.


Replies to Convert 2D simulation to 3D

Re: Convert 2D simulation to 3D -
Francisco Esquembre
235 Posts

Hi George,

This is a non-standard :-) and very risky way of doing what you want. Sometimes, properties and names of 3D elements do not match those of 'similar' 2D elements...

A better way would be to recreate, yes, one by one, the 3D view using the standard (magic-wand + edition of properties) procedure...

This being said, I am very curious about what you did and what caused the problem... so, if you want to send me the EJSS file, I can try to take a deep look at it, and see if I could help.

My email is fem@um.es (and am the author of EJS, so I know about the internals of EJS).

Bests,
Paco



Re: Convert 2D simulation to 3D -
George Barouxis
8 Posts

Hi Paco,

I know of course that you are the author of EJS, we have talked a few times through email when you helped me with other difficulties.

Yes, I see that some properties do not match. For instance, 2d bodies have sizeX and sizeY while 3D spheres have radius.

I will sent you the ejss file, but it is a mess, no wonder it gave an error. I will see if it is possible to correct the errors (perhaps through regex replacements that will respect each element's properties), and if not, I will build the simulation from scratch.



OSP Projects:
Open Source Physics - EJS Modeling
Tracker
Physlet Physics
Physlet Quantum Physics
STP Book