NTNUJAVA Virtual Physics Laboratory
Enjoy the fun of physics with simulations!
Backup site http://enjoy.phy.ntnu.edu.tw/ntnujava/

Information about this web site => Question related to Physics or physics related simulation => Topic started by: mickey2times on July 15, 2010, 08:13:16 pm



Title: Adding Ghost Trace images
Post by: mickey2times on July 15, 2010, 08:13:16 pm
I have a simulation of two blocks racing.  You can input the initial position, initial velocity and acceleration of each object and see how their motions compare to each other.  I would like to add ghost traces that would leave a ghost image of each object's position at some set time interval (every 0.1 time unit or something).  And I am at a loss to figure out how to do this.

I attached my file if anyone wants to take a look.

Thanks in advance for any help.


Title: Re: Adding Ghost Trace images
Post by: ahmedelshfie on July 15, 2010, 08:25:33 pm
Could you explain what kind of file that you attach,, the path is wrong.


Title: Re: Adding Ghost Trace images
Post by: mickey2times on July 15, 2010, 09:23:55 pm
It was the EJS 4.0 .ejs file, (i guess what used to be xml file).  I have attached the exported jar file also.  I thought you could File>Open the .ejs file in the EJS Console (just have to choose your own directory path to import it into), but now that I think about it, you might need the newest version (4.3) of EJS, the older only accept .xml ... I think.

Not sure if that answered your question though, so if you have others please let me know.


Title: Re: Adding Ghost Trace images
Post by: Fu-Kwun Hwang on July 15, 2010, 10:34:27 pm
What you can do is adding a trace GUI element.
You have set FPS=100 and time step is 0.01 s
If you want to set ghost image every 0.1 s, then you should set the Skip property to 9.
So that it only draw a marker every 10 input points.
You can set Connected property to false so that no line are connected between markers.

You need to select one of the Marker Shape and set a value for Marker Size.
Marker Color is optional.

You need to enter variable/expression for Input X and Input Y so that EJS can draw it.

There are more optional property you can set up. Please check out http://www.um.es/fem/EjsWiki/Main/ElementsTrace for detail information about each property.


Title: Re: Adding Ghost Trace images
Post by: ahmedelshfie on July 15, 2010, 11:02:12 pm
Sorry for this wrong is my wrong. ;)


Title: Re: Adding Ghost Trace images
Post by: mickey2times on July 16, 2010, 08:11:11 pm
Thank you very much for your help.  I knew it was there, just could not figure out what settings I needed to use.  With them added this sim will now be very useful with my first year high school students to really visualize the differences in various types of motion, and what constant velocity and acceleration really mean.

If anyone wants to look at the updated one, I attached the exported file.


Title: Re: Adding Ghost Trace images
Post by: Fu-Kwun Hwang on July 16, 2010, 09:10:49 pm
You can make your simulation appear as an applet (like other simulations at this web site.)
You will find Upload new EJS jar file checkbox when you edit message (or create new topic).
It is located at the same line as "Post" button.

Click the checkbox, and you will find a button to upload the file from your local file folder.
The simulation will appear at the end of the message automatically.

You can even updated the jar when you edit the message (if you have new version), the procedure is the same as above.
I add  this feature so that user at this forum can share created EJS simulation easily. Please try it.


Title: Re: Adding Ghost Trace images
Post by: mickey2times on July 19, 2010, 11:00:23 am
Hope this works, attempting to upload it as an applet.


Title: Re: Adding Ghost Trace images
Post by: Fu-Kwun Hwang on July 19, 2010, 01:41:19 pm
It was not working because the latest EJS use "ejs" replaced "xml" and it was not supported.
Another problem is that your ejs source is not begin with alphabet (your source stars with '2').
I tried to modified the code and change the data manually. It seems to be working now.


Title: Re: Adding Ghost Trace images
Post by: mickey2times on July 19, 2010, 11:42:39 pm
Thanks a lot again.  I just started out designing with EJS and you site is a great reference and help.


Title: Re: Adding Ghost Trace images
Post by: DonaSima on September 26, 2010, 11:16:55 am
Ghost image analysis is based on the built-in inverse ray trace algorithm, which does not require to rebuild the optical system.


__________________________
Espresso Coffee (http://www.gourmetcoffeeblend.ws)