Saturday, January 19, 2013

1/16/2012


Today's shuttle to Siena College was canceled due to the large amount of snow. However, I met with my mentor through GChat and e-mail. It was really hard, because I have more than five windows open on my laptop and questions that took a long time to answer.

The homework I did for this meeting was to change units of my simulation to pixels to make it look more realistic. Before we had to change gravity to a small value to make it fit in the screen and make the ball drop slower, but with the conversion gravity can be 9.8 m/s^2 and would still look the same. To do this I had to add two more variables to my simulation:
float pixels2meters=___;
float meters2pixels=___;
In my case my one pixel is equal to 10 meters, and one meter equals to .1 pixel. This did not work so well after all. I sent my simulation to Mr. Bellis so that he could check it for me. We ended up putting more variables in:
float meters2pixels = 10;
float pixels2meters = 1/meters2pixels;
int frameRateSpeed = 30; // frames per second

size(windowWidth, windowHeight);
   noStroke();     
   frameRate(frameRateSpeed);   //set frameRat to the same as frameRate Speed

t = t+(1.0/frameRateSpeed); // Also changed the time so that time increases when one frame goes through (1/30 sec= one frame)

Another homework was to find how to add text to my simulation. It was really fun, because I kept changing the text color to the colors I want. The things I typed to make text appear was:

PFont f;
    f = createFont("Microsoft Sans Serif", 16, true);   //first one was font type (I looked at the font types in my files for word and feel like this is the best one, second one is font size, and third one means anti-aliasing on)
    textFont (f, 24);
    fill (255);
    text("Yvonne Yen", 10, 240);        //text, size, and location (y-coordinate)
    text("Free Fall", 10, 270); 
During the meeting today, I learned how to add timer on my simulation.

String time_text = "time: "+nf(t,1,2);
   text (time_text, 10, 580);
I took this as an example and created a height measurer on my simulation too! :)

String Height_text= "Height:"+ nf(-y+y0,1,2);    //it is -y+y because I want to know how far the ball traveled as it drops so I set the "y" as the negative value (dropping) and add the initial position to exclude it from the measurement. 
   text (Height_text, 10, 610);

I also changed the color of the texts for height and time too~:)

HERE IS THE END PRODUCT:

Looking at this we can know how much the height has dropped in how many sections. I will check if this simulation is accurate later...

Next week, I will have to communicate with my mentor through e-mail again, because it is Emma's MLK service day.

:)







1 comment:

  1. Yvonne, you make great use of a missed day! I am impressed with the amount of work that you accomplished remotely, and with the progress that you have made with your simulation. Including all of your code is very interesting, and I especially like how you include a screenshot for comparison. I appreciate how you took care to find the best font to include in your model. Keep up the good work!

    ReplyDelete