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.

is _view.trailSet.newSegment(); working for array set? post and replies

Return to the is _view.trailSet.newSegment(); working for array set? thread
Login to post to this thread

is _view.trailSet.newSegment(); working for array set?
lookang Avatar
lookang
222 Posts

dear prof paco,



i managed to get is _view.trail.newSegment(); to work for a single line which is wonderful. thanks!

but array of lines work with the line of code too?

is _view.trailSet.newSegment(); // working for array set?

see my scr for details on the initialize button!
i commented out the line to ensure the model runs, enabling it will hang the model


more info can be found here
http://weelookang.blogspot.sg/2015/02/ejss-2-cannon-aim-at-each-other.html

Post edited February 10, 2015 at 10:54 AM EST.

Post edited February 10, 2015 at 10:54 AM EST.

Attached File: ejss_src_projectile2cannon.zip


OSP@SG blog
OSP@SG Digital Library

Replies to is _view.trailSet.newSegment(); working for array set?

Re: is _view.trailSet.newSegment(); working for array set? -
Francisco Esquembre
228 Posts

Dear LooKang,

The newSegment() function works for trail sets too, but on an individual basis. Hecnce, you must provide the index of the rail in the set for which you want a new segment. As in:

_view.trailSet.newSegment(0); // New segment in the first trail of the set

Of course, a for loop can be used to create a new segment in all the trails of the set.

Paco



Re: Re: is _view.trailSet.newSegment(); working for array set? -
lookang Avatar
lookang
222 Posts

Dear Prof Paco,

it looks logical but i could not get it to work with one or both lines.

in my init button the actions to take are
//  _view.trailSet.newSegment(0);
//_view.trailSet.newSegment(1);
memorycolor=memorycolor+1;
t=0;
x[0] = xs0;
y[0] =ys0;
x[1] = xs1;
y[1] =ys1;
vx[0] = vxs[0];
vy[0] =vys[0];
vx[1] = vxs[1];
vy[1] =vys[1];
_initialize();

when i un-comment out the first 2 lines or a single line would freeze the simulation after i click on the button that has this line active.

i am using EJS_5.1_150125, is there a newer release?


OSP@SG blog
OSP@SG Digital Library


Re: Re: Re: is _view.trailSet.newSegment(); working for array set? -
Francisco Esquembre
228 Posts

Dear Loo Kang,

You found a bug in the code! I have fixed it.

You need the new EjsS at http://fem.um.es/EjsWiki/uploads/Download/EJS_5.1_150210.zip
This one will run your code ok.

This is an experimental EjsS where we have done some internal changes. If you find any other bug, please let me know.

Best regards,

Paco



Re: Re: Re: Re: is _view.trailSet.newSegment(); working for array set? -
lookang Avatar
lookang
222 Posts

thank you prof paco, array _view.trailSet.newSegment(0) and _view.trailSet.newSegment(1) works!

i found another bug

right panel all gone missing

see picture

Attached File: bug216201590901AM.png


OSP@SG blog
OSP@SG Digital Library


Re: Re: Re: Re: Re: is _view.trailSet.newSegment(); working for array set? -
Francisco Esquembre
228 Posts

Hi Loo Kang,

I'd need to source code for this simulation to see what happened.

You can attach it here or email it to me at fem@um.es

Best,

Paco



Re: Re: Re: Re: Re: Re: is _view.trailSet.newSegment(); working for array set? -
lookang Avatar
lookang
222 Posts

Try this
https://www.dropbox.com/s/5dtz6iahw4v9l06/ejss_src_SHM04.zip?dl=0

In addition.
The other bug I notice
1 trail that t>0 active seems to experience I bigger gap than t>0.
2 the CSS used to make invisible the panel is not working as previous versions of ejss was able to do.

Thanks!


OSP@SG blog
OSP@SG Digital Library


Re: Re: Re: Re: Re: Re: is _view.trailSet.newSegment(); working for array set? -
lookang Avatar
lookang
222 Posts

how about this?
:)attached

Attached File: ejss_model_SHM15.zip


OSP@SG blog
OSP@SG Digital Library


Re: Re: Re: Re: Re: Re: Re: is _view.trailSet.newSegment(); working for array set? -
Francisco Esquembre
228 Posts

Dear Loo Kang,

It seems to me that the release you used for this model has some bug that we fixed recently.

Please, use this release of EjsS (or later, if public) and recompile the model.

http://fem.um.es/EjsWiki/uploads/Download/EJS_5.1_150222.zip

Paco



Re: Re: Re: Re: Re: Re: Re: Re: is _view.trailSet.newSegment(); working for array set? -
lookang Avatar
lookang
222 Posts

dear prof,

thank for the new link to EJSS.

i compile some files and found a bug

the line
_view.plottingPanel.setProperty("CSS",{ "display" : "none" });
which i used a checkbox to action on and off,
it used to work in EJS_5.1_141205
but not for EJS_5.1_150125, EJS_5.1_150210(with the error of the right panel solved already), EJS_5.1_150222.

hope it can help in your newer releases of the cool EJSS tool :)

Attached File: 225201543214PM.png


OSP@SG blog
OSP@SG Digital Library


Re: Re: Re: Re: Re: Re: Re: Re: Re: is _view.trailSet.newSegment(); working for array set? -
Francisco Esquembre
228 Posts

Dear Loo Kang,

Please, send me the SRC file for this example and I'll see why it does not work.

Paco



Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: is _view.trailSet.newSegment(); working for array set? -
lookang Avatar
lookang
222 Posts

attached
thanks

Attached File: ejss_src_SHM15.zip


OSP@SG blog
OSP@SG Digital Library


Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: is _view.trailSet.newSegment(); working for array set? -
Francisco Esquembre
228 Posts

Hi,

I tried the example with my latest EjsS at http://fem.um.es/EjsWiki/uploads/Download/EJS_5.1_150302.zip

and it works ok. (While the Full screen link to your dropbox doesn't.) So, I think we somehow fixed this problem.

Please, try the latest EjsS. It is not yet public, but it will be soon.

Paco



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