Given a list of 3D coordinates that define the surface( `Point3D1`

, `Point3D2`

, `Point3D3`

, and so on), how to calculate the centroid of the surface?

More specifically, I am looking for a natural extension of the following 2D centroid algorithm in 3 or more dimension:

Any idea?

**P/S: All the points are coplanar, this is the assumption.**