Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I think your formula is wrong. h0 should be the initial velocity (which in your case is 0 m/s) and it should be multiplied with time.</p> <p>This is the correct one <a href="http://www.physicsclassroom.com/Class/1DKin/U1L6c.cfm" rel="nofollow noreferrer">from</a> <img src="https://i.stack.imgur.com/kyeDE.gif" alt="This is the for"></p> <p>So having said that, Vi*t is always 0 since your initial velocity is 0. What's left is 0.5 * 9.8 * timeElapsed * timeElapsed.</p> <pre><code> config.objectPos.Y = 0 //initial velocity + 0.5f * config.acceleration * timeElapsed * timeElapsed; </code></pre> <p>Also objectPost.Y should always start from 0 meters since it's starting from the top and it's going to fall.</p> <p>You can refer to this Console app code. Run it and see the time elapsed compared and compare it to the <a href="http://www.physicsclassroom.com/Class/1DKin/U1L6c.cfm" rel="nofollow noreferrer">results in</a> </p> <p>It should be 1.32 seconds.</p> <pre><code>using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; namespace Physics_16783733 { class Program { static void Main(string[] args) { MyClass c = new MyClass(); } } public class MyClass { public Settings config = new Settings(); public Stopwatch timer = new Stopwatch(); public float timeElapsed; //in Seconds public Thread thread; static ManualResetEvent control; public MyClass() { control = new ManualResetEvent(false); //New thread (Drawing) thread = new Thread(new ThreadStart(Drawing)); thread.IsBackground = true; thread.Start(); control.WaitOne(); } public void Drawing() { try { while (true) { if (config.objectPos.Y &lt; config.sizeBitmap.Height) { timer.Start(); } else { timer.Stop(); control.Set(); } //Bitmap screen = new Bitmap(this.pboxScreen.Width, this.pboxScreen.Height); SendScreen(); } } catch (ThreadAbortException tae) { Console.WriteLine(tae.Message); } } private void SendScreen() { timeElapsed = timer.ElapsedMilliseconds / 1000f; //Converting Milliseconds to Seconds if (config.objectPos.Y &lt; config.sizeBitmap.Height) //Check if object isn't in the ground { //formula used is in http://www.physicsclassroom.com/Class/1DKin/U1L6c.cfm config.objectPos.Y = 0 //initial velocity + 0.5f * config.acceleration * timeElapsed * timeElapsed; } //Update txtbox (textbox) Console.WriteLine("Object position Y: " + config.objectPos.Y.ToString()); Console.WriteLine("Time elapsed : " + timeElapsed.ToString()); //using the data from http://www.physicsclassroom.com/Class/1DKin/U1L6c.cfm, time elapsed should be 1.32 seconds } } public class Settings { //I used data from http://www.physicsclassroom.com/Class/1DKin/U1L6c.cfm //where the given is: //vi = 0.0 m/s //d = -8.52 m //a = - 9.8 m/s2 public Size sizeBitmap; //height of the place where the object will start free falling public PointF objectPos; //Initial Position public float acceleration; public Settings() { sizeBitmap.Height = 8.52; objectPos.Y = 0; acceleration = 9.8f; } } public struct PointF { public float Y { get; set; } } public struct Size { public double Height { get; set; } } } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload