public Body(double bodyMass, double bodySize, SimPoint bodyStartingPosition, SimPoint bodyStartingVelocity, SimulationSpace space) { Mass = bodyMass; Size = bodySize; Position = bodyStartingPosition; Velocity = bodyStartingVelocity; IsGravitySource = defaultGravitySource; simSpace = space; bodyNumber = currentBodyNumber++; }
public Body(SimPoint bodyStartingPosition, SimulationSpace space) { Mass = defaultValue; Size = defaultValue; Position = bodyStartingPosition; Velocity = defaultStartingVelocity; IsGravitySource = defaultGravitySource; simSpace = space; bodyNumber = currentBodyNumber++; }
public Renderer(SimulationSpace space, Canvas simulationCanvas, CoreDispatcher dispatcher, MainPage mainPage) { this.simSpace = space; this.circles = new List <Ellipse>(); this.trailsPositions = new List <SimPoint>(); this.rand = new Random(); this.simCanvas = simulationCanvas; this.ZoomFactor = 1.0; this.dispatcher = dispatcher; this.mainPage = mainPage; trailsBrush = new SolidColorBrush(Colors.Yellow); }
public static void LoadLowEarthOrbit(GravitySim sim) { // To make a braided spiral with ISS trails use calc setting of 2 and then speed up by 800% // 4 and 1600% are also interesting SetScenarioName(sim, "Low Earth Orbit (ISS + 4 Starlink satellites) Scenario"); sim.ClearSim(); SimulationSpace simulationSpace = new SimulationSpace(SimulationSpace.Space.LEO); // LEO or GEO Space -> Km, minutes, Kg, Km/h sim.SetSimSpace(simulationSpace); sim.SetCalculationSettings(new CalculationSettings(100, false, false)); sim.SetSimRounding(0); // Must remain at zero to have circular orbits // === EARTH === sim.AddBodyActual(SolarSystem.EarthMassKg, true, SolarSystem.EarthRadiusKm * 2.0, 3, new SimPoint(0.0, 0.0), new SimPoint(0.0, 0.0)); //// === ISS === sim.AddBodyActual(0.0, false, sim.simSpace.SmallestBodySizePx * 2.5, 1, new SimPoint(-SolarSystem.ISS_OrbitRadiusKm, 0.0), new SimPoint(0.0, simulationSpace.CircularOrbitVelocity(SolarSystem.EarthMassKg, SolarSystem.ISS_OrbitRadiusKm))); // Satellites - Starlink // 12 Starlinks //double[] startingAngles = { 30.0, 45.0, 60.0, 120.0, 135.0, 150.0, 210.0, 225.0, 240.0, 300.0, 315.0, 330.0 }; //foreach (double angle in startingAngles) // 36 Starlinks for (double angle = 0.0; angle < 360.0; angle += 10.0) { SimPoint position, velocity; simulationSpace.InitializeCircularOrbit(angle, SolarSystem.StarlinkOrbitRadiusKm, SolarSystem.EarthMassKg, out position, out velocity); sim.AddBodyActual(0.0, false, sim.simSpace.SmallestBodySizePx, (int)Renderer.ColorNumber.BodyColorMedGrey, position, velocity); } // GPS //sim.AddBodyActual(0.0, false, sim.simSpace.SmallestBodySizePx * 5.0, 4, // new SimPoint(-SolarSystem.GPS_OrbitRadiusKm, 0.0), new SimPoint(0.0, simulationSpace.CircularOrbitVelocity(SolarSystem.EarthMassKg, SolarSystem.GPS_OrbitRadiusKm))); // Geosynchronus orbit //sim.AddBodyActual(0.0, false, sim.simSpace.SmallestBodySizePx * 2.0, 5, // new SimPoint(-SolarSystem.GeosynchronousOrbitRadiusKm, 0.0), new SimPoint(0.0, simulationSpace.CircularOrbitVelocity(SolarSystem.EarthMassKg, SolarSystem.GeosynchronousOrbitRadiusKm))); sim.SetMonitoredBody(1); sim.SetMonitoredValues(); sim.SetAccelerationLimits(false, 0.0, 0.0); }
public GravitySim(Canvas simulationCanvas, MainPage simulationPage, CoreDispatcher dispatcher) { bodies = new List <Body>(); simCanvas = simulationCanvas; simPage = simulationPage; simSpace = new SimulationSpace(SimulationSpace.Space.Null); renderer = new Renderer(simSpace, simCanvas, dispatcher, simPage); // accelerations default to null, they're newed when they're needed simCalcSettings = new CalculationSettings(); simElapsedTime = 0.0; checkSim = false; simRounding = 0; accelerationLimitOn = false; minimumSeparationSquared = 1.0; SpeedFactor = 1.0; }
public void SetSimSpace(SimulationSpace space) { this.simSpace = space; renderer.simSpace = space; renderer.SetSimulationTransform(simCanvas.ActualWidth, simCanvas.ActualHeight); }