Nextrek
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
package nextrek.arse.service;
import nextrek.math.Matrix;
import android.location.Location;
public class ARData {
public static float MT = 6.0f;
private static float WORLD_RADIUS_MT = 6371.0f * MT;
public static double refLong;
public static double refAlt;
public static double refLat;
public static void setRef(double longitude, double altitude, double latitude) {
refLong = longitude;
refAlt = altitude;
refLat = latitude;
//Log.d(TAG, "lal: " + refLong + " " + refAlt + " " + refLat);
}
public static float getX(double longitude) {
return (float) (refLong - longitude) * WORLD_RADIUS_MT;
}
public static float getZ(double latitude) {
return (float) (refLat - latitude) * WORLD_RADIUS_MT;
}
public static float getY(double altitude) {
return (float) (refAlt - altitude) * MT;
}
public static final Location hardFix = new Location("ATL");
static {
// long = x
hardFix.setLongitude(12.485425f);
// lat = z
hardFix.setLatitude(41.855234f);
hardFix.setAltitude(1.0f);
}
private static Location currentLocation = hardFix;
private static Matrix rotationMatrix = new Matrix();
public static Location getCurrentLocation() {
synchronized (ARData.currentLocation) {
return ARData.currentLocation;
}
}
/**
* Set the current location.
*
* @param currentLocation
* Location to set.
* @throws NullPointerException
* if Location param is NULL.
*/
public static void setCurrentLocation(Location currentLocation) {
if (currentLocation == null)
throw new NullPointerException();
//Log.d(TAG, "current location. location=" + currentLocation.toString());
synchronized (currentLocation) {
ARData.currentLocation = currentLocation;
}
}
/**
* Set the rotation matrix.
*
* @param rotationMatrix
* Matrix to use for rotation.
*/
public static void setRotationMatrix(Matrix rotationMatrix) {
synchronized (ARData.rotationMatrix) {
ARData.rotationMatrix = rotationMatrix;
}
}
/**
* Get the rotation matrix.
*
* @return Matrix representing the rotation matrix.
*/
public static Matrix getRotationMatrix() {
synchronized (ARData.rotationMatrix) {
return rotationMatrix;
}
}
}
|
Revision |
Author |
Commited |
Message |
4
|
FMMortaroli
|
Fri 19 Apr, 2013 16:54:38 +0000 |
|