[plotgen] now 1 red point per polygon

This commit is contained in:
Suwako Moriya 2018-11-11 18:20:58 +01:00
parent 23b5a719b5
commit c3f56c25ec

View File

@ -9,12 +9,12 @@ import math
def circlepolygon(radius, center, resolution=20):
points=[[center[0] + math.cos(((2*math.pi)/resolution)*i)*radius*1.15, center[1] + math.sin(((2*math.pi)/resolution)*i)*radius] for i in range(resolution)]
return points
def genplot(diclist):
def genplot(diclist, resolution=150):
for area in tqdm(diclist, ncols=50):
for figure in area['zone']:
if figure[0] == 'cercle' :
xcoords,ycoords=[],[]
for xaxis,yaxis in circlepolygon(figure[1]/100000, figure[2::], resolution=100):
for xaxis,yaxis in circlepolygon(figure[1]/100000, figure[2::], resolution=resolution):
xcoords.append(xaxis)
ycoords.append(yaxis)
xcoords.append(xcoords[0])
@ -30,7 +30,7 @@ def genplot(diclist):
xcoords.append(xcoords[0])
ycoords.append(ycoords[0])
plt.plot(xcoords,ycoords,'b')
plt.plot(xcoords,ycoords,'rs')
plt.plot(sum(xcoords)/len(xcoords),sum(ycoords)/len(ycoords),'rs')
plt.fill(xcoords,ycoords,'g')
return plt