How to calculate the area of a polygon? [duplicate]

Possible Duplicate:
How quickly we forget - basic trig. Calculate the area of a polygon

For a program I want to calculate the area of a given polygon. It may have every form, the sides even may cross. Do you can give me pointers to a way to calculate areas for such polygons?

-
How is the polygon given? If its boundary is not a simply closed curve you will have to specify what is meant by "area". –  Christian Blatter Sep 22 '11 at 13:42
It is given as a closed linestring, but the lines can cross. –  Mnementh Sep 22 '11 at 13:58
it would be worth looking at this question: math.stackexchange.com/questions/15739/… –  yasmar Sep 22 '11 at 18:56
See the Wikipedia entry on this topic: Polygon area –  Joseph O'Rourke Sep 22 '11 at 22:58