-
Notifications
You must be signed in to change notification settings - Fork 0
/
CurrentCoordinates.cs
56 lines (46 loc) · 1.25 KB
/
CurrentCoordinates.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Android.App;
using Android.Content;
using Android.OS;
using Android.Runtime;
using Android.Views;
using Android.Widget;
namespace AccelTest
{
class CurrentCoordinates
{
public Coordinates Coords;
public CoordinatesChanged CoordsChanged;
public void Reset()
{
Coords.X = 0;
Coords.Y = 0;
Coords.Z = 0;
Coords.Theta = 0;
Coords.Phi = 0;
Coords.Vx = 0;
Coords.Vy = 0;
Coords.Vz = 0;
Coords.OmegaP = 0;
Coords.OmegaT = 0;
}
public CurrentCoordinates()
{
Coords = new Coordinates();
Reset();
}
public void IntegrateCoordinates(OnSensorChangedArgs args)
{
Coords.X += Coords.Vx * args.TimeStep;
Coords.Y += Coords.Vy * args.TimeStep;
Coords.Z += Coords.Vz * args.TimeStep;
Coords.Vx += args.AccelerationX * args.TimeStep;
Coords.Vy += args.AccelerationY * args.TimeStep;
Coords.Vz += args.AccelerationZ * args.TimeStep;
CoordsChanged(Coords);
}
}
}