We’ve recently been working with beacon technology at work. If you’re not up to date with what they are I’d suggest checking out this wikipedia article, but in a nut shell they’re little devices that periodically emit a bluetooth signal and based on the strength of said signal one can work out how far away the beacon is from the receiver (in most cases a users phone).

However accuracy seems to fluctuate fairly badly when there is no clear line of sight. To combat this we decided to place the beacons on the roof as well as using at least three beacons in any given area, this allows us to firstly average out any signal fluctuates as well as triangulating the exactly position of the user.

Below is an example of how to use the as3 Intersect class. Simply pass in a Vector of at least three Vector3D objects to the Intersect.of() function (in this example I’m using 4). Each Vector3D object that is past in should contain the x, y, z location of the beacon and the signal “distance” as w/radius.

var intersection:Vector3D = Intersect.of(
   new [
      new Vector3D(x, y, z, radius),
      new Vector3D(x, y, z, radius),
      new Vector3D(x, y, z, radius),
      new Vector3D(x, y, z, radius)

The above will return the best intersection of four beacons as a Vector3D object.

Get Adobe Flash player

Note: The class currently does not take into account z (height).

[repo path=”peteshand/triangulation”]