Trilateration system using 3 latitude and longitude points, and 3 radius distances in PHP, C#, Java and Javascript
Where can Trilateration and Triangulation be used in general?
- Get the location of a device that sends signals to an antenna (GPS).
- Get the location of any device connected to a Wi-Fi network.
- Get the epicenter of seismic events (Earthquakes).
And several other uses, with this library so simple you can perform the calculation, of course, this library does not know the parameters and these have to apply to you.
Point Class:
new Point(Latitude,Longitude,RadiusDistanceInKilometers);
Trilateration Class:
new Trilateration();
Trilateration Class: Functions
Compute(Point1,Point2,Point3);
<?php
require("Point.php");
require("Trilateration.php");
$p1=new Point(-19.6685,-69.1942,84);
$p2=new Point(-20.2705,-70.1311,114);
$p3=new Point(-20.5656,-70.1807,120);
$a=new Trilateration();
$b=$a->Compute($p1,$p2,$p3);
echo "LatLon: ".$b[0].", ".$b[1];
?>
LatLon: -20.548034139289, -69.266174618331
using System;
namespace net.TBMSP.Code.Trilateration{
class Program{
static void Main(string[] args){
Point p1=new Point(-19.6685,-69.1942,84);
Point p2=new Point(-20.2705,-70.1311,114);
Point p3=new Point(-20.5656,-70.1807,120);
double[] a=Trilateration.Compute(p1,p2,p3);
Console.WriteLine("LatLon: "+a[0]+", "+a[1]);
}
}
}
LatLon: -20.548034139289, -69.266174618331
package net.TBMSP.Code.Trilateration;
public class Main{
public static void main(String[] args){
Point p1=new Point(-19.6685,-69.1942,84);
Point p2=new Point(-20.2705,-70.1311,114);
Point p3=new Point(-20.5656,-70.1807,120);
double[] a=Trilateration.Compute(p1,p2,p3);
System.out.print("LatLon: "+a[0]+", "+a[1]);
}
}
LatLon: -20.548034139289, -69.266174618331
<!DOCTYPE html>
<html>
<body>
<p id="latlon"></p>
<script src="Trilateration.js"></script>
<script>
//Array[Latitude,Longitude,RadiusDistanceInKilometers]
var p1=[-19.6685,-69.1942,84];
var p2=[-20.2705,-70.1311,114];
var p3=[-20.5656,-70.1807,120];
var a=Compute(p1,p2,p3);
document.getElementById("latlon").innerHTML="LatLon: "+a;
</script>
</body>
</html>
LatLon: -20.548034139289, -69.266174618331
Autor: @TBMSP TBM SP soporte@tbmsp.net