from ActiveShapeModels import ASM, Point, Shape
import matplotlib.pyplot as plt
import seaborn as sns
import math
import numpy as np

s1 = Shape( [ Point(200,300), Point(100, 200), Point(300, 50 ) ] )
s2 = Shape( [ Point(150,250), Point(50, 100 ), Point(250, 0) ] )



f, ((ax1,ax2),(ax3,ax4)) = plt.subplots(2,2, sharex =True, sharey = True)
s1.draw( sns.xkcd_palette( ["light blue" ]), ax1)
s2.draw( sns.xkcd_palette( ["light blue"] ), ax2)


cmShape  = ASM.centroid( s1)

cmMeanShape = ASM.centroid( s2  )


ax1.scatter( cmShape.x, cmShape.y, c='r')
ax2.scatter( cmMeanShape.x, cmMeanShape.y, c='r')
ax1.plot( [s1.shapePoints[0].x, s1.shapePoints[1].x],
         [s1.shapePoints[0].y, s1.shapePoints[1].y],
         color= 'r', ls = '-')

ax2.plot( [s2.shapePoints[0].x, s2.shapePoints[1].x],
         [s2.shapePoints[0].y, s2.shapePoints[1].y],
         color= 'r', lw = 1, ls = '-')
import numpy as np

#s1 = Shape( [ Point(200,300), Point(100, 200), Point(300, 50 ) ] )
#s2 = Shape( [ Point(150,250), Point(50, 100 ), Point(250, 0) ] )

s1 = Shape([
    Point(857, -129),
    Point(89, -409),
    Point(-404, 254),
    Point(96, 957),
    Point(877, 712)
])

f, ((ax1, ax2), (ax3, ax4)) = plt.subplots(2, 2)

s1.draw(sns.xkcd_palette(["light blue"]), 0, ax1)
#s2.draw( sns.xkcd_palette( ["light blue"] ), ax2)

cmShape = ASM.centroid(s1)
#cmMeanShape = ASM.centroid( s2  )

ax1.scatter(cmShape.x, cmShape.y, c='r')
#ax2.scatter( cmMeanShape.x, cmMeanShape.y, c='r')
ax1.plot([s1.shapePoints[0].x, s1.shapePoints[1].x],
         [s1.shapePoints[0].y, s1.shapePoints[1].y],
         color='r',
         ls='-')

#ax2.plot( [s2.shapePoints[0].x, s2.shapePoints[1].x],
#         [s2.shapePoints[0].y, s2.shapePoints[1].y],
#         color= 'r', lw = 1, ls = '-')
from ActiveShapeModels import ASM, Point, Shape
import matplotlib.pyplot as plt
import seaborn as sns
import math
import numpy as np

s1 = Shape([Point(200, 300), Point(100, 200), Point(300, 50)])
s2 = Shape([Point(150, 250), Point(50, 100), Point(250, 0)])

f, ((ax1, ax2), (ax3, ax4)) = plt.subplots(2, 2, sharex=True, sharey=True)
s1.draw(sns.xkcd_palette(["light blue"]), ax1)
s2.draw(sns.xkcd_palette(["light blue"]), ax2)

cmShape = ASM.centroid(s1)

cmMeanShape = ASM.centroid(s2)

ax1.scatter(cmShape.x, cmShape.y, c='r')
ax2.scatter(cmMeanShape.x, cmMeanShape.y, c='r')
ax1.plot([s1.shapePoints[0].x, s1.shapePoints[1].x],
         [s1.shapePoints[0].y, s1.shapePoints[1].y],
         color='r',
         ls='-')

ax2.plot([s2.shapePoints[0].x, s2.shapePoints[1].x],
         [s2.shapePoints[0].y, s2.shapePoints[1].y],
         color='r',
         lw=1,
         ls='-')

t = [[cmShape.x - cmMeanShape.x], [cmShape.y - cmMeanShape.y]]
from ActiveShapeModels import ASM, Point, Shape
import matplotlib.pyplot as plt
import seaborn as sns
import math
import numpy as np

#s1 = Shape( [ Point(200,300), Point(100, 200), Point(300, 50 ) ] )
#s2 = Shape( [ Point(150,250), Point(50, 100 ), Point(250, 0) ] )



s1 = Shape( [ Point(857, -129), Point(89,-409), Point(-404,254), Point( 96,957), Point(877,712) ])

f, ((ax1,ax2),(ax3,ax4)) = plt.subplots(2,2)

s1.draw( sns.xkcd_palette( ["light blue" ]), 0, ax1)
#s2.draw( sns.xkcd_palette( ["light blue"] ), ax2)

cmShape  = ASM.centroid( s1 )
#cmMeanShape = ASM.centroid( s2  )


ax1.scatter( cmShape.x, cmShape.y, c='r')
#ax2.scatter( cmMeanShape.x, cmMeanShape.y, c='r')
ax1.plot( [s1.shapePoints[0].x, s1.shapePoints[1].x],
         [s1.shapePoints[0].y, s1.shapePoints[1].y],
         color= 'r', ls = '-')

#ax2.plot( [s2.shapePoints[0].x, s2.shapePoints[1].x],
#         [s2.shapePoints[0].y, s2.shapePoints[1].y],
#         color= 'r', lw = 1, ls = '-')