from my 2004 sketchbook: calcualte the centroid of a triangle. code may be based on code by <a href="http://local.wasp.uwa.edu.au/~pbourke/geometry/polyarea/">paul bourke</a>, not sure tough.
click and drag the corners to see centroid being updated ..
To tweak this sketch, first download it.
Make your updates, then upload your tweak!