Esempio n. 1
0
        Vector3d gravityVector(GravationalObject otherObject)
        {
            Double   distance = Vector3d.Distance(positionVector, otherObject.LastVector);
            float    F        = (float)(6.67408 * Math.Pow(10, -11)) * (float)((mass * otherObject.mass) / Math.Pow(distance, 2));   //meters, kg, seconds
            Vector3d vectorn  = otherObject.LastVector - positionVector;

            vectorn.Normalize();
            vectorn = vectorn * F;
            return(vectorn);
        }
Esempio n. 2
0
        private Vector3d gravityVector(GravationalObject otherObject)
        {
            var distance = Vector3d.Distance(positionVector, otherObject.LastVector);
            var F        = (float)(6.67408 * System.Math.Pow(10, -11)) *
                           (float)(mass * otherObject.mass / System.Math.Pow(distance, 2)); //meters, kg, seconds
            var vectorn = otherObject.LastVector - positionVector;

            vectorn.Normalize();
            vectorn = vectorn * F;
            return(vectorn);
        }
Esempio n. 3
0
 public void step2(GravationalObject gravitationObject, float dt)
 {
     ForceVec = ForceVec + gravityVector(gravitationObject);
 }