Getting position of Fixture in Farseer Physics

So as the title says, I’m trying to get a position of a Fixture in Farseer Physics. So the first step I took was to see how the DebugView did it.(line 445 in https://github.com/tinco/Farseer-Physics/blob/master/DebugViews/DebugView%20XNA/DebugViewXNA.cs, draws all of the shape types).

Here we can see, all we gotta do is cast the fixtures shape into its actual shape type, such as Circle then use CircleShape.Position. AWESOME! But what about rectangles and Polygons and other shapes? Well the shape type of Rectangle Fixture, is a Polygon, so really we need to just figure it out for the polygon now(it doesn’t have Position property :frowning: ). Here is the code for the Polygon vs the Circle

                case ShapeType.Circle:
                {
                    CircleShape circle = (CircleShape)fixture.Shape;

                    Vector2 center = MathUtils.Mul(ref xf, circle.Position);
                    float radius = circle.Radius;
                    Vector2 axis = MathUtils.Mul(xf.q, new Vector2(1.0f, 0.0f));

                    DrawSolidCircle(center, radius, axis, color);
                }
                break;

            case ShapeType.Polygon:
                {
                    PolygonShape poly = (PolygonShape)fixture.Shape;
                    int vertexCount = poly.Vertices.Count;
                    Debug.Assert(vertexCount <= Settings.MaxPolygonVertices);

                    for (int i = 0; i < vertexCount; ++i)
                    {
                        _tempVertices[i] = MathUtils.Mul(ref xf, poly.Vertices[i]);
                    }

                    DrawSolidPolygon(_tempVertices, vertexCount, color);
                }
                break;`

so I’m really lost at this point. Could anyone help me on this please?

    public static Vector2 Rotate(Vector2 Position, Vector2 Origin, float angleInDegrees) {
        double angleInRadians = angleInDegrees * (Math.PI / 180);
        double cosTheta = Math.Cos(angleInRadians);
        double sinTheta = Math.Sin(angleInRadians);
        return new Vector2 {
            X =
                (int)
                (cosTheta * (Position.X - Origin.X) -
                sinTheta * (Position.Y - Origin.Y) + Origin.X),
            Y =
                (int)
                (sinTheta * (Position.X - Origin.X) +
                cosTheta * (Position.Y - Origin.Y) + Origin.Y)
        };
    }
    public static Vector2 PositionOfFixture(Body obj, int Number) {
        switch (obj.FixtureList[Number].Shape.ShapeType) {
            case (ShapeType.Circle):
            Vector2 pos = ((CircleShape)obj.FixtureList[Number].Shape).Position;
            return Rotate(ConvertUnits.ToDisplayUnits(pos), obj.Position, obj.Rotation);

            case (ShapeType.Polygon):
            PolygonShape shape = (PolygonShape)obj.FixtureList[Number].Shape;
            List<Vector2> vecs = new List<Vector2>();
            Vector2 total = Vector2.Zero;
            foreach (Vector2 v in shape.Vertices) {
                vecs.Add(ConvertUnits.ToDisplayUnits(v));
                total += vecs[vecs.Count - 1];
            }
            Vector2 position = total / (vecs.Count);
            return obj.Position + Rotate(position, new Vector2(0, 0), MathHelper.ToDegrees(obj.Rotation));

        }
        throw new ArgumentException("Couldn't grab ShapeType");
    }'

I have yet to test on Circle, and haven’t tested on polygons that are not Rectangles(however see no reason why it wont work)