from menpo.shape import PointDirectedGraph
import numpy as np


def pointgraph_from_circle(fitting):
    y, x = fitting.center
    radius = fitting.diameter / 2.0
    return PointDirectedGraph(np.array(((y, x),
                                        (y + radius, x),
                                        (y + radius, x + radius),
                                        (y, x + radius))),
                              np.array([[0, 1], [1, 2], [2, 3], [3, 0]]))

@@ -98,20 +98,24 @@
 g):%0A    
-y, x
+diameter
  = fitti
@@ -121,11 +121,13 @@
 ing.
-cen
+diame
 ter%0A
@@ -139,24 +139,16 @@
 adius = 
-fitting.
 diameter
@@ -154,16 +154,74 @@
 r / 2.0%0A
+    y, x = fitting.center%0A    y -= radius%0A    x -= radius%0A
     retu
@@ -305,22 +305,24 @@
    (y + 
-radius
+diameter
 , x),%0A  
@@ -368,26 +368,30 @@
 y + 
-radius, x + radius
+diameter, x + diameter
 ),%0A 
@@ -437,22 +437,24 @@
 (y, x + 
-radius
+diameter
 ))),%0A   

Fix the circle to rectangle code