area of convex polygon

I need to find the area of some convex polygons for a program, whose vertices are known in the Cartesian coordinate system.

Polygon – from MathWorld gives a fairly involved equation to find that area. The problem is I’m trying to KISS, and that I don’t need the equation to be able to solve for convex polygons. I don’t even need it to give an exact answer, just an educated guess that’s correct within 25% or so.

I considered making up something that just took the perimeter and some relation of side lengths (the ratio of smallest to largest, or something like that) and bashing a number out of that, since the script needs to know the side lengths anyway. But the effort to find that equation would probably outweigh any non-simplistic angst from using the true equation, so I don’t know if that’s a good idea.

So, I come to you, dopers. Any ideas? Is there a simpler equation for the area of a convex polygon if the lengths of 2<n<10 sides are already known?

The impetus for this little foray into geometry (and ultimately, the end result) was provided by (and will be given back to) an ongoing Dope conversation, if that makes any difference.

How about Pick’s Theorem?

How would one go about finding all latice points on the interior of a polygon of n sides whose vertices are not integers and keep it simpler than using the big polygon equation?

An interesting approach, though.

Well, I was hoping that would work, I like Pick’s theorem. The only way to use Pick’s theorem that I see would be to scale it up or down to try and get the vertices as close to lattice points as possible, then live with any error you get from that, but that sounds like way to much trouble.

That approach will definitely not work. Picture a square getting flattened out by bringing two opposite corners together–illustrating that the same sides enclosing the original square can also be used to enclose an arbitrarily small area.

Actually, that first formula on the page you linked to doesn’t really seem like it would be that bad to put into code. Just order your vertices counter-clock wise (x(1),y(1)),…,(x(n),y(n)), add up:

x(1)y(2) + x(2)y(3) + … + x(n)y(1), and add up:

y(1)x(2) + y(2)x(3) + … + y(n)x(1),

subtract the latter from the former, then divide by two.

My vote’s with Cabbage, who said it all – use the formula you found, it’s precise and not difficult to code.