Skip to content

Instantly share code, notes, and snippets.

View josuebustos's full-sized avatar

Josue Bustos josuebustos

View GitHub Profile
@josuebustos
josuebustos / trilateration.js
Created April 13, 2021 06:50 — forked from kdzwinel/trilateration.js
Simple trilateration algorithm implementation in JavaScript.
function getTrilateration(position1, position2, position3) {
var xa = position1.x;
var ya = position1.y;
var xb = position2.x;
var yb = position2.y;
var xc = position3.x;
var yc = position3.y;
var ra = position1.distance;
var rb = position2.distance;
var rc = position3.distance;
@josuebustos
josuebustos / trilateration.js
Created April 12, 2021 04:09 — forked from richard-flosi/trilateration.js
JavaScript Trilateration
// Created by Derrick Cohodas (dav-)
// Based on the Python example by StackExchange user wwnick from http://gis.stackexchange.com/a/415/41129
// Requires the Mathjs library - http://mathjs.org/
var math = require('mathjs')
/**
* Represents a coordinate with a distance
* @param {Number} lat Latitude
1. Visit https://awslabs1.awsapps.com/start/
2. Log in with your username and password
3. Your AMB network should already be created with the following settings:
NetworkName acme
NetworkDescription ACME consortium blockchain
Edition STARTER
FirstMemberName ACME1stMember
FirstMemberDescription The first member in the ACME consortium
FirstMemberAdminUsername acme1admin
<div id="consolelog" style="font-family: 'Courier New', Courier, monospace; font-size: 12px; margin: 40px 30px 0px; background-color: white; border: 2px solid black; padding: 10px;"></div>
<input type="text" id="consoleinput" style="margin: 0px 30px; width: 400px;" onkeypress="return evalConsoleInput(event, this.value);" />
<script type="text/javascript">
var appendConsole = function(message, type) {
var color = "black";
if (type === "error") {
color = "red";
} else if (type === "debug") {