private static IUniverse SimpleUniverse() { double gravConstant = 1.0; double solarMass = 1.0; // kg double planetMass = 1.0; // kg double dist = 1.0; // meters double planetSpeed = Math.Sqrt((gravConstant * solarMass) / dist); var earth = new RigidBody6DOF( new EuclideanKinematics( new Transform(new Vector3(dist, 0, 0), Matrix3.Identity), new Vector3(0, planetSpeed, 0), Vector3.Zero ), planetMass, Matrix3.Identity ); //var sunGravity = Potentials.InverseSquare(gravConstant * solarMass * planetMass); // GMm / r^2 return new BasicUniverse { //DynamicBodies = { earth }, //Potentials = { sunGravity } }; }
private static IUniverse SunEarthUniverse() { double gravConstant = 6.67408 * Math.Pow(10, -11); double solarMass = 1.98855 * Math.Pow(10, 30); // kg double earthMass = 5.972 * Math.Pow(10, 24); // kg double earthToSun = 149598023 * Math.Pow(10, 3); // meters double earthSpeed = 29.78 * Math.Pow(10, 3); // meters/s var earth = new RigidBody6DOF( new EuclideanKinematics( new Transform(new Vector3(earthToSun, 0, 0), Matrix3.Identity), new Vector3(0, earthSpeed, 0), Vector3.Zero ), earthMass, Matrix3.Identity ); //var sunGravity = Potentials.InverseSquare(gravConstant * solarMass * earthMass); // GMm / r^2 return new BasicUniverse { //DynamicBodies = { earth }, //Potentials = { sunGravity } }; }
public static IUniverse BinaryUniverse() { var bodyOne = new RigidBody6DOF( new EuclideanKinematics( new Transform(posOne, Matrix3.Identity), velOne, Vector3.Zero ), massOne, Matrix3.Identity ); var bodyTwo = new RigidBody6DOF( new EuclideanKinematics( new Transform(posTwo, Matrix3.Identity), velTwo, Vector3.Zero ), massTwo, Matrix3.Identity ); //var grav = Potentials.InverseSquare(gravConstant * massOne * massTwo); // same underlying potential //var gravOne = new TranslatedScalarField(grav, () => bodyOne.Transform.Pos); //var gravTwo = new TranslatedScalarField(grav, () => bodyTwo.Transform.Pos); return new BasicUniverse { //DynamicBodies = { bodyOne, bodyTwo }, //Potentials = { gravOne, gravTwo } }; }