Skip to content
This repository has been archived by the owner on Jan 17, 2024. It is now read-only.
/ Trilateration Public archive

Trilateration system using 3 latitude and longitude points, and 3 radius distances in PHP, C#, Java and Javascript

License

Notifications You must be signed in to change notification settings

TBMSP/Trilateration

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Trilateration

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.


Class parameters and functions

Point Class:

new Point(Latitude,Longitude,RadiusDistanceInKilometers);

Trilateration Class:

new Trilateration();

Trilateration Class: Functions

Compute(Point1,Point2,Point3);

PHP Version Example

<?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];
?>

Result

LatLon: -20.548034139289, -69.266174618331

C# Version Example

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]);
    }
  }
}

Result

LatLon: -20.548034139289, -69.266174618331

Java Version Example

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]);
  }
}

Result

LatLon: -20.548034139289, -69.266174618331

Javascript Version Example

<!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>

Result

LatLon: -20.548034139289, -69.266174618331

Autor: @TBMSP TBM SP [email protected]

About

Trilateration system using 3 latitude and longitude points, and 3 radius distances in PHP, C#, Java and Javascript

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published