Alexandre,
Thanks for your post!
If you want to get the barycenter for a polygon, just use the GetCenterPoint API, if you want to get the center of the boundingbox , you should call the
polygonShape.GetBoundingBox().GetCenterPoint()
Following is some test code snipped.
RingShape ringShape = new RingShape();
ringShape.Vertices.Add(new Vertex(0, 0));
ringShape.Vertices.Add(new Vertex(0, 1));
ringShape.Vertices.Add(new Vertex(1, 0));
ringShape.Vertices.Add(new Vertex(0.1, 0.9));
ringShape.Vertices.Add(new Vertex(0, 0));
PolygonShape polygonShape = new PolygonShape(ringShape);
//0.033333333333333, 0.633333333333333
PointShape centerPointShape = polygonShape.GetCenterPoint();
//0.5,0.5
PointShape geometryCenterPointShape = polygonShape.GetBoundingBox().GetCenterPoint();
Let me know if you have more questions.
Thanks.
Yale