Wi-Fi triangulation using android smartphone
Posted
by
user1887020
on Programmers
See other posts from Programmers
or by user1887020
Published on 2012-12-08T16:30:50Z
Indexed on
2012/12/09
5:18 UTC
Read the original article
Hit count: 189
android
How to make application for wifi triangulation using android platform? This project will be implemented inside the building. No GPS needed. Just using wifi only and doing triangulation to get the current position of the user inside the building. I got minimum 3 access point to implement it. But how to start code in android and integrate triangulation inside android coding? I got the algorithm to do it.. but is there any chance that I can get it done? Because this project is actually want to replace the floor directory board into a smartphone floor directory so that user can find their way to their room for example to the lab.
public class Triangulation
{
public Triangulation()
{
int dist_1, dist_2, dist_3; //variable for the distances
int x1, x2, x3; //coordinates of x
int y1, y2, y3; //coordinates of y
int final_dist1, final_dist2; //final distance after calc
dist_1 = 1;
dist_2 = 2;
dist_3 = 3;
x1 = 5; //test inputs
x2 = 2;
x3 = 4;
y1 = 2;
y2 = 2;
y3 = 5;
final_dist1 = ((dist_1 * dist_1) - (dist_2 * dist_2) – (x1 * x1) + (x2 * x2) - (y1 * y1) + (y2 * y2)) / 2;
final_dist2 = ((dist_2 * dist_2) - (dist_3 * dist_3) – (x2 * x2) + (x3 * x3) - (y2 * y2) + (y3 * y3)) / 2;
initial_a1 = x1 - x2; initial_a2 = x2 - x3; initial_b1 = y1 - y2; initial_b2 = y2 - y3; //-----------------------STEP 1--------------------------------------
int a1 = initial_a1 / initial_a1;
int a2 = initial_a2 / initial_a1;
int b1 = initial_b1 / initial_a1;
int b2 = initial_b2 / initial_a1;
final_dist1 /= initial_a1;
final_dist2 /= initial_a1;
//-----------------------STEP 2--------------------------------------
a2 = a2 -a2;
final_dist2 = -(initial_a2) * final_dist1 + final_dist2;
//-----------------------STEP 3--------------------------------------
a2 /= b2; final_dist2 = final_dist2 / b2; b2 /= b2;
//-------------------------STEP 4-----------------------------------
b1 = b1 - b1; final_dist1 = -(initial_b1) * final_dist2 + final_dist1;
}
}
© Programmers or respective owner