Beispiel #1
0
        private static double[] VectorUnitario(Particula p1, Particula p2)
        {
            double[] aux = new double[p1.posicion.Length];
            double   d   = Interaccion.DistanciaCartesiana(p1, p2);

            for (int i = 0; i < aux.Length; i++)
            {
                aux[i] = (p1.posicion[i] - p2.posicion[i]) / d;
            }
            return(aux);
        }
Beispiel #2
0
        public static double[] Electroestatica(Particula p1, Particula p2)
        {
            double[] f    = new double[p1.aceleracion.Length];
            double   dist = Interaccion.DistanciaCartesiana(p1, p2);

            double[] u = Interaccion.VectorUnitario(p1, p2);
            for (int i = 0; i < f.Length; i++)
            {
                f[i] = (Particula.K * (p1.carga * p2.carga) / (dist * dist)) * u[i];
            }
            return(f);
        }
Beispiel #3
0
        public static double[] Gravitatoria(Particula p1, Particula p2)
        {
            double[] f    = new double[p1.aceleracion.Length];
            double   dist = Interaccion.DistanciaCartesiana(p1, p2);

            double[] u = Interaccion.VectorUnitario(p1, p2);
            for (int i = 0; i < f.Length; i++)
            {
                f[i] = -1 * (Particula.G * (p1.masa * p2.masa) / (dist * dist)) * u[i];
            }
            return(f);
        }