public static void Init() { _GameService = new GameService(); _GameService.Init(); _PhysicSystem = new PhysicalSystem(); _PhysicSystem.Open(); }
private void SolveButton_Click(object sender, EventArgs e) { Particle Earth = new Particle(new Mass(5.97237E24)); Particle particle = new Particle(new Mass(Convert.ToDouble(massBox.Text))); Spring spring = new Spring(particle, Earth, Convert.ToDouble(springRateBox.Text)); Damper damper = new Damper(spring, Convert.ToDouble(dampingRatioBox.Text)); Time lengthOfSimulation = new Time(Convert.ToDouble(timeBox.Text)); particle.interactions.Add(spring); particle.interactions.Add(damper); particle.position.values[0] = 1.0; PhysicalSystem system = new PhysicalSystem(new List <Particle>() { particle, Earth }); int numberOfPoints = 1024; Time timeStep = lengthOfSimulation / numberOfPoints; chart1.ChartAreas["ChartArea"].AxisX.Maximum = lengthOfSimulation.value; for (Time time = new Time(); time <= lengthOfSimulation; time += timeStep) { chart1.Series["Series"].Points.AddXY(time.value, particle.position.values[0]); system.Iterate(timeStep); } this.Refresh(); }
public void TestPhysicalSystem() { var physicalSystem = new PhysicalSystem(new Sphere(new Meter(1)).SetMass(new Kilogram(5)), new Sphere(new Meter(1)).SetMass(new Kilogram(7))); Assert.AreEqual(12, physicalSystem.GetTotalMass <Kilogram>().Value); }
public async Task ImplicitAsyncTest(int numberOfAsteroids = 0) { system = new PhysicalSystem(new List <Particle>(GetCelestialBodies(numberOfAsteroids))); while (!end) { try { system.Iterate(timeStep); simulatedTime.value += timeStep.value; } catch (Exception ex) { MessageBox.Show(ex.Message); } } }
public void TestPhysicalSystem() { var physicalSystem = new PhysicalSystem(new Sphere(new Meter(1)).SetMass(new Kilogram(5)), new Sphere(new Meter(1)).SetMass(new Kilogram(7))); Assert.AreEqual(12, physicalSystem.GetTotalMass<Kilogram>().Value); }