Guest User

Untitled

a guest
May 19th, 2012
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.37 KB | None | 0 0
  1. String[] werte;
  2. int position = 0;
  3. double ax, ay, az, dt, v0_x = 0, v0_y = 0, v0_z = 0, vvv_x = 0, vvv_y = 0, vvv_z = 0, weg_x, weg_y, weg_z;
  4.  
  5. if (variable.Contains("Position"))
  6. {
  7.     DateTime EndZeit = DateTime.Now;
  8.     TimeSpan GZ = EndZeit - StartZeit;
  9.     StartZeit = DateTime.Now;
  10.     dt = GZ.Ticks/10000;
  11.     if (dt != 0)
  12.     {
  13.         werte = variable.Split(';');
  14.         ax = Double.Parse(werte[1]);
  15.         ay = Double.Parse(werte[2]);
  16.         az = Double.Parse(werte[3]);
  17.         if (position == 0)
  18.         {
  19.             vvv_x = 0;
  20.             vvv_y = 0;
  21.             vvv_z = 0;
  22.         }
  23.         if (position == 1)
  24.         {
  25.             v0_x = (ax * dt) + vvv_x;
  26.             vvv_x = v0_x;
  27.             v0_y = (ay * dt) + vvv_y;
  28.             vvv_y = v0_y;
  29.             v0_z = (az * dt) + vvv_z;
  30.             vvv_z = v0_z;
  31.         }
  32.         if (position == 2)
  33.         {
  34.             weg_x = (1 / 2 * ax * Math.Pow(dt, 2)) + (v0_x * dt);
  35.             weg_y = (1 / 2 * ay * Math.Pow(dt, 2)) + (v0_y * dt);
  36.             weg_z = (1 / 2 * az * Math.Pow(dt, 2)) + (v0_z * dt);
  37.             //Eichen
  38.             weg_x = weg_x / 1000;
  39.             weg_y = weg_y / 1000;
  40.             weg_z = weg_z / 1000;
  41.             //weg an Maus weiterleiten      
  42.             MausFunktionRelativ((int)weg_x,(int)weg_y);
  43.             position = 0;
  44.         }
  45.         position++;
  46.     }
  47. }
Advertisement
Add Comment
Please, Sign In to add comment