Center of Mass (surface) with bmesh (edit mode)

following this troymcconaghy.com/2015/06/25/how-blender-calculates-center-of-mass/ I’m trying to find center of mass (surface) of an object. I’m doing
loc = sum(([email protected]_center_median_weighted() for f in bm.faces), Vector())/(len(bm.faces))
but this is not exactly this(referring to origin to center of mass(vol)). any idea?

ok I found some complementary information, not with bmesh and using triangles
https://blender.stackexchange.com/questions/53022/why-is-my-center-of-mass-not-calculating-correctly
and this
https://blender.stackexchange.com/questions/31062/how-can-i-calculate-and-draw-the-center-of-mass-of-various-objects-with-python
some maths around this

well problem if the origin has been moved