AS3 Triangulation

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.

?View Code ACTIONSCRIPT3
var intersection:Vector3D = Intersect.of(
   new <Vector3D>[
      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).

No description or homepage.

3 Comments

  1. Thanks! A example very interesting. Would be great to see a example implementing beacons.

  2. Hi Pete.

    This looks very good indeed. I have been wanting to try triangulation using AS3 for a while now. I have downloaded your files but currently cant run AS3 for technical reasons which I will soon sort out.Just one thing that puzzles me. Knowing the X Y Z coordinates of the 4 beacons is easy. However in a scenario where you want to use triangulation to locate your position relative to the beacons how would you know the “radius” to each beacon ? Maybe this will become clear to me when I actually run your code.

    Thanks

    Paul

  3. To answer my own question – I have no experience with Bluetooth Beacons but perhaps when your device locates a beacon it also gets an idea of the radial distance to the beacon?

    Paul

Submit a Comment

Your email address will not be published. Required fields are marked *