public void ShouldCalculateExample2() { List <OrbitalBody> bodies = new List <OrbitalBody>() { new OrbitalBody(new Vector3(-1, 0, 2)), new OrbitalBody(new Vector3(2, -10, -7)), new OrbitalBody(new Vector3(4, -8, 8)), new OrbitalBody(new Vector3(3, 5, -1)), }; JovianSystem jovianSystem = new JovianSystem(bodies); jovianSystem.DoTimeSteps(10); Assert.Equal(179, jovianSystem.GetSystemEnergy()); }
public void ShouldCalculateExample3() { List <OrbitalBody> bodies = new List <OrbitalBody>() { new OrbitalBody(new Vector3(-8, -10, 0)), new OrbitalBody(new Vector3(5, 5, 10)), new OrbitalBody(new Vector3(2, -7, 3)), new OrbitalBody(new Vector3(9, -8, -3)), }; JovianSystem jovianSystem = new JovianSystem(bodies); jovianSystem.DoTimeSteps(100); Assert.Equal("pos=<x=8, y=-12, z=-9>, vel=<x=-7, y=3, z=0>", jovianSystem.OrbitalBodies[0].ToString()); Assert.Equal("pos=<x=13, y=16, z=-3>, vel=<x=3, y=-11, z=-5>", jovianSystem.OrbitalBodies[1].ToString()); Assert.Equal("pos=<x=-29, y=-11, z=-1>, vel=<x=-3, y=7, z=4>", jovianSystem.OrbitalBodies[2].ToString()); Assert.Equal("pos=<x=16, y=-13, z=23>, vel=<x=7, y=1, z=1>", jovianSystem.OrbitalBodies[3].ToString()); Assert.Equal(1940, jovianSystem.GetSystemEnergy()); }