Пример #1
0
        public void AddAttractionVector(Steerable theOther)
        {
            Vector attractionVector = new Vector(Location, theOther.Location);
            double gforce           = Gravitation.Force(this, theOther);

            attractionVector.x *= gforce / Mass;
            attractionVector.y *= gforce / Mass;
            //System.Diagnostics.Debug.WriteLine(attractionVector.stringify());
            //Debug.WriteLine("force: {0}", gforce);
            MovementVector.addVector(attractionVector);
        }
Пример #2
0
        //private static double G = 6.67408E-11;

        public static double Force(Steerable obj1, Steerable obj2)
        {
            double force = G * ((obj1.Mass * obj2.Mass) / Math.Pow(new Vector(obj1.Location, obj2.Location).length(), 2));

            return(force);
        }