How to set position of box2dshape

I’m confused about ofxBox2dBaseShape::setPosition(float x, float y).
Is this method going to set polygon’s center to desired point?
Here is my code that how I used this method:

ofVec2f personOrigin = persons[nPressedPersonIndex]->getOrigin();

triangles[nPressedPersonIndex].get()->setPosition(personOrigin);
ofVec2f point = triangles[nPressedPersonIndex]->getPosition();

However, the value of “point” is different from the value of “personOrigin”.
That is, like, I want to set the position of a polygon to (567, 56), but it goes to (1654, 589).

If this method is not used to set polygon’s center to desired position, how can I change my polygon’s position?

I suffered from this problem for a few days. Thank god, finally, I found the way after I just posted this topic. :sob::sob::sob::sob::sob::sob:

  1. I recalculated my all vertexes and clear my polygon
  2. then I created a new polygon with my lovely new vertexes.

If there is some other simple method to solve this problem, please leave your comment. :persevere:

There is an example of this in the git repo where we draw a shape with the mouse and then create a triangles from that shape. Basically you want to check if the shape has a body then destroy it. This works fine for static shapes or edges but not shapes that simulate like a ball falling.

// make a line with ofPolyline...
// make the edge in box2d
if(edgeLine.isBody()) {
	edgeLine.destroy();
}
edgeLine.addVertexes(line);
edgeLine.setPhysics(0.0, 0.5, 0.5);
edgeLine.create(box2d.getWorld());
line.clear();