]> Pileus Git - ~andy/iBeaconNav/blob - src/edu/ucla/iBeaconNav/Vect.java
Add quaternion and vector code
[~andy/iBeaconNav] / src / edu / ucla / iBeaconNav / Vect.java
1 package edu.ucla.iBeaconNav;
2
3 class Vect
4 {
5         public double x = 0;
6         public double y = 0;
7         public double z = 0;
8
9         /* Constructors */
10         public Vect()
11         {
12         }
13
14         public Vect(double x, double y, double z)
15         {
16                 this.x = x;
17                 this.y = y;
18                 this.z = z;
19         }
20
21         /* Set functions */
22         public void set(double x, double y, double z)
23         {
24                 this.x = x;
25                 this.y = y;
26                 this.z = z;
27         }
28
29         /* Add functions */
30         public void add(Vect v)
31         {
32                 this.x += v.x;
33                 this.y += v.y;
34                 this.z += v.z;
35         }
36         public void add(double off)
37         {
38                 this.x += off;
39                 this.y += off;
40                 this.z += off;
41         }
42
43         /* Multiply functions (scalar) */
44         public void mul(Vect v)
45         {
46                 this.x *= v.x;
47                 this.y *= v.y;
48                 this.z *= v.z;
49         }
50         public void mul(double sf)
51         {
52                 this.x *= sf;
53                 this.y *= sf;
54                 this.z *= sf;
55         }
56 }