views:

163

answers:

6

So I'm working on a piece of code to take positional data for a RC Plane Crop Duster and compute the total surface area transversed (without double counting any area). I cannot figure out how to calculate the area for a given period of operation.

Given the following Table Calculate the area the points cover.

x,y
1,2
1,5
4,3
6,6
3,4
3,1

Any Ideas? I've browsed Greens Theorem and I'm left without a practical concept in which to code.

Thanks for any advise

+1  A: 

I'm not entirely sure that you're looking for "Surface area" as much as you're looking for Distance. It seems like you want to calculate the distance between one point and the next for that list. If that's the case, simply use the Distance Formula.

If the plane drops a constant width of dust while flying between those points, then the area is simply the distance between those points times the width of the spray.

Dave McClelland
I really like this method, I forgot to put this in the description, This method has the flaw of double counting area covered twice. Is there a easy way to filter out double counted amounts?
TelsaBoil
@TelsaBoil - I hadn't realized that double counting would be an issue. Check out Lior Kogan's answer, it seems very useful.
Dave McClelland
+2  A: 

Someone mathier than me may have to verify the information here. But it looks legit: http://www.wikihow.com/Calculate-the-Area-of-a-Polygon and fairly easy to apply in code.

Angelo R.
A: 

You will have to divide the complex polygon approximately into standard polygons (triangles, rectangles etc) and then find area of all of them. This is just like regular integration (only difference is that you are yet to find a formula to approximate your data).

The above points are when you assume that you are forming a closed polygon with your data.

ivymike
Or, better yet, turn that area integral into a contour integral and take a walk around the perimeter using Gaussian quadrature.
duffymo
+4  A: 
  1. Build the convex hull from the given points

    Algorithms are described here

    See a very nice python demo + src

  2. Calculate its area

    Python code is here

Lior Kogan
This is exactly what I was looking for. Thanks for the help!
TelsaBoil
A: 

If your points are guaranteed to be on an integer grid - as they are in your example - (and you really are looking for enclosed area) would Pick's Theorem help?

Chris
A: 

Use to QHull to triangulate the region, then sum the areas of the resulting triangles.

Throwback1986