Triangulation

Theory

Triangulation is a common method for finding a coordinate based on the direction the point in question is in relative to two other points and the distance between these two other points. Triangulation is commonly used in surveying, navigation, wireless communications, astronomy, and just about anywhere it is necessary to calculate the location of an object from a distance.

Take for example two points A and B, each having a heading pointing towards some distant point C. Using triangulation we can calculate the coordinate of C. As you can see in the following figure this creates a triangle.

clip_image002

Figure 1 Triangulation

Using the law of sines we can make the following connection between the three points.

clip_image004

Using the formulas that have already been derived in this article we can calculate the distance between point A and B, we can also calculate the bearing from A to B. Once we know this we can calculate the angles clip_image006 andclip_image008. Once we have these two angles we can calculate the angle clip_image010 using the following formula:

clip_image012

From here we can calculate the distances AC and BC using the following formulas:

clip_image014

clip_image016

We only need to calculate one of the distances. Once we have that we can use the distance, and the point is based at either A of B, and the associated heading to calculate the coordinate of C.

Application

This function for calculating the coordinate of a point using triangulation will take in two VELatLong objects and two bearings that are between 0 and 180 degrees. This function will return a VELatLong object for the point in which the provided information triangulates to. When calculating the angle between two headings we are only interested in the inner angle because we are working with a triangle all the angles will be under 180˚.

function triangulate(latlongA,latlongB,bearingAC,bearingBC)
{
var AB = haversineDistance(latlongA,latlongB);
var bearingAB = calculateBearing(latlongA,latlongB);
var angleBAC = angleBetweenHeadings(bearingAB,bearingAC,"inner");
var angleABC = angleBetweenHeadings(180-bearingAB,bearingBC,"inner");
var angleBCA = 180 - angleBAC - angleABC;

var AC = AB*Math.sin(DegToRad(angleABC))/Math.sin(DegToRad(angleBCA));

return calculateCoord(latlongA, bearingAC, AC);
}

Listing 1 Triangulation Function Information on the calculateBearing method can be found here: http://rbrundritt.spaces.live.com/blog/cns!E7DBA9A4BFD458C5!393.entry
Information on the haversineDistance method can be found here: http://rbrundritt.spaces.live.com/blog/cns!E7DBA9A4BFD458C5!317.entry
Information on the calculateCoord method can be found here: http://rbrundritt.spaces.live.com/blog/cns!E7DBA9A4BFD458C5!400.entry
The following post has additional information on the RadToDeg and DegToRad methods: http://rbrundritt.spaces.live.com/blog/cns!E7DBA9A4BFD458C5!257.entry
Information on the angleBetweenHeading method can be found here: http://rbrundritt.spaces.live.com/blog/cns!E7DBA9A4BFD458C5!444.entry

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s