Centroid of a Quadrilateral?

Hi,

I am writing a program where I need to work out the centroid of a quadrilateral given the coordinates of its 4 corners. I know this can be done graphically quite easily but I was wondering if there is a formula I can use to code it?

Advanced Thanks.

Mark.

Re: Centroid of a Quadrilateral?

What a pity HallsofIvy, you almost had a beautiful answer. The weighing is not necessary, just divide the quadrilateral by one of its two diagonals like you suggested and connect the centers of gravity of both resulting triangles, i.e. their centroids, and repeat the procedure with the OTHER diagonal of the quadrilateral. The intersection of both connectors of centers of gravity must be the center of gravity of the Quadrilateral!