NTNUJAVA Virtual Physics Laboratory
Enjoy the fun of physics with simulations!
Backup site http://enjoy.phy.ntnu.edu.tw/ntnujava/
December 14, 2017, 03:36:20 am *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 
   Home   Help Search Login Register  
"Choose a job you love, and you will not have to work for a day in your life." ...Confucius (551-479 BC)
Google Bookmarks Yahoo My Web MSN Live Netscape Del.icio.us FURL Stumble Upon Delirious Ask FaceBook

Pages: [1]   Go Down
  Print  
Author Topic: How to make the trace in a plot to clear after _initialize()  (Read 6776 times)
0 Members and 1 Guest are viewing this topic. Click to toggle author information(expand message area).
lookang
Hero Member
*****
Offline Offline

Posts: 1784


http://weelookang.blogspot.com


WWW
«
Embed this message
on: February 11, 2009, 09:28:22 am » posted from:Singapore,,Singapore

I am making changes to the initialization page
// to make the button initialise do the same thing as reset thanks to tips
t = 0;
// bring carts to start position
x1 = -0.8 ;
x2 = 0 ;
 

but i realize the plot trace draw a line back to (t,momentum) = (0,0)

when do i add the line make the trace clear ?


And suddenly, i remember Christain Wolfgang codes.
i just understood how to do this by using on initialisation page.

_view.trace.clear();



cool, i solve it myself ?!
when typing then i realised, so just post it for others to read. Wink
Logged
Fu-Kwun Hwang
Administrator
Hero Member
*****
Offline Offline

Posts: 3080



WWW
«
Embed this message
Reply #1 on: February 11, 2009, 11:19:31 am »

You can check out Fire work (projectile motion) and find out how I did it.
Logged
lookang
Hero Member
*****
Offline Offline

Posts: 1784


http://weelookang.blogspot.com


WWW
«
Embed this message
Reply #2 on: February 16, 2009, 01:11:07 pm » posted from:SINGAPORE,SINGAPORE,SINGAPORE

interesting way and good.

i see
declare variable "clear" type boolean in variable page

insert clear into into traceset clear at input as in picture.

insert codes in fixed conditions

if(t<dt)clear=true;  // appears to clear if t smaller than dt, so that is in the beginning?
else clear=false;
if(count>=n || (t>tf && t>ts+td)){ // another condition to clear true Smiley
  clear=true; 
  _initialize();
 }

Thanks!
am i roughly correct?


* clear.PNG (42.23 KB, 740x413 - viewed 383 times.)
Logged
Fu-Kwun Hwang
Administrator
Hero Member
*****
Offline Offline

Posts: 3080



WWW
«
Embed this message
Reply #3 on: February 16, 2009, 05:16:07 pm »

Yes. I think you got the ideas.
There are more than one way to do it. You can try other options, too! Wink
Logged
Pages: [1]   Go Up
  Print  
"Choose a job you love, and you will not have to work for a day in your life." ...Confucius (551-479 BC)
 
Jump to:  


Related Topics
Subject Started by Replies Views Last post
Why the shadow edge not clear in cloudy?
Optics
didi 0 15661 Last post October 17, 2005, 05:01:21 pm
by didi
It is fun to play with prism. (light trace and intensity due to refraction)
Optics
Fu-Kwun Hwang 2 29191 Last post July 25, 2012, 08:23:38 am
by Fu-Kwun Hwang
is it possible to make applet make a sound when i condition is met?
Questions related to EJS
lookang 8 10452 Last post December 22, 2008, 12:10:01 pm
by lookang
Lesson 2: How to add trace x-t/ vx-t
EJS tutorial (How to create simulation with EJS)
Fu-Kwun Hwang 0 7517 Last post March 16, 2009, 09:59:53 pm
by Fu-Kwun Hwang
How to add diffrent positions to trace in satellite motioin applet
Questions related to EJS
ahmedelshfie 23 18955 Last post October 21, 2011, 10:34:25 pm
by ahmedelshfie
Powered by MySQL Powered by PHP Powered by SMF 1.1.13 | SMF © 2006-2011, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 0.059 seconds with 23 queries.since 2011/06/15