- Main Page
- Classes
- Files

- File List

# C:/Users/Andreas Schiffler/Desktop/SVN/NewGamePhysics/NewGamePhysics/Physics/DoubleSquarePendulumAcceleration.cs

    00001 // --------------------------------------------------------
    00002 // DoubleSquarePendulumAcceleration.cs
    00003 // (A. Schiffler, 2009)
    00004 // --------------------------------------------------------
    00005
    00006 namespace NewGamePhysics.Physics
    00007 {
    00008     using System;
    00009     using System.Collections.Generic;
    00010     using System.Text;
    00011
    00012     using NewGamePhysics.Mathematics;
    00013
    00018     public class DoubleSquarePendulumAcceleration : ISecondDerivative
    00019     {
    00023         private double l;
    00024
    00028         private double m;
    00029
    00033         private double g;
    00034
    00038         public DoubleSquarePendulumAcceleration(double l, double m, double g)
    00039         {
    00040             this.l = l;
    00041             this.m = m;
    00042             this.g = g;
    00043         }
    00044
    00048         public double L
    00049         {
    00050             get
    00051             {
    00052                 return this.l;
    00053             }
    00054         }
    00055
    00059         public double M
    00060         {
    00061             get
    00062             {
    00063                 return this.m;
    00064             }
    00065         }
    00066
    00070         public double G
    00071         {
    00072             get
    00073             {
    00074                 return this.g;
    00075             }
    00076
    00077             set
    00078             {
    00079                 this.g = value;
    00080             }
    00081         }
    00082
    00091         VectorN ISecondDerivative.GetValue(double t, VectorN theta, VectorN omega)
    00092         {
    00093             double theta1 = theta[0];
    00094             double theta2 = theta[1];
    00095             double omega1 = omega[0];
    00096             double omega2 = omega[1];
    00097
    00098             VectorN acceleration = new VectorN(2);
    00099             double sqrt2 = Math.Sqrt(2.0);
    00100             acceleration[0] = (-3 * (8 * g * Math.Sin((Math.PI - 4 * theta1) / 4.0) - 4 * sqrt2 * g * Math.Sin(theta1) +
    00101             6 * g * Math.Cos(Math.PI / 4.0 - theta1 + theta2) * Math.Sin(theta2) + 3 * l * Math.Cos(2 * (theta1 - theta2)) * Math.Pow(omega1, 2) +
    00102             4 * sqrt2 * l * Math.Sin(Math.PI / 4.0 - theta1 + theta2) * Math.Pow(omega2, 2))) / (2.0 * l * (-20 + 9 * Math.Pow(Math.Cos(Math.PI / 4.0 - theta1 + theta2), 2)));
    00103
    00104             acceleration[1] = (3 * (g * (3 * Math.Cos(Math.PI / 4.0 - theta1 + theta2) * (Math.Cos(theta1) - 2 * Math.Sin(theta1)) + 5 * sqrt2 * Math.Sin(theta2)) +
    00105             5 * sqrt2 * l * Math.Sin(Math.PI / 4.0 - theta1 + theta2) * Math.Pow(omega1, 2) +
    00106             (3 * l * Math.Cos(2 * (theta1 - theta2)) * Math.Pow(omega2, 2)) / 2.0)) / (l * (-20 + 9 * Math.Pow(Math.Cos(Math.PI / 4.0 - theta1 + theta2), 2)));
    00107
    00108             return acceleration;
    00109         }
    00110     }
    00111 }