def cubo(x,y,x1,y1,x2,y2,x3,y3):
l = math.sqrt((x-x1)**2+(y-y1)**2)
trib11 = []
trib12 = []
trif11 = []
trif12 = []
trif21 = []
trif22 = []
trif31 = []
trif32 = []
trif41 = []
trif42 = []
trib21 = []
trib22 = []
coloref = 'b'
spessore = 0
trasp =0.10
#base giù
trib11.append([x,y,0])
trib11.append([x1,y1,0])
trib11.append([x2,y2,0])
trib12.append([x,y,0])
trib12.append([x2,y2,0])
trib12.append([x3,y3,0])
qua1 = a3.art3d.Poly3DCollection(trib11,facecolors=coloref, linewidths=spessore, alpha=trasp)
qua2 = a3.art3d.Poly3DCollection(trib12,facecolors=coloref, linewidths=spessore, alpha=trasp)
spazio.add_collection(qua1)
spazio.add_collection(qua2)
#faccia 1
trif11.append([x,y,0])
trif11.append([x1,y1,0])
trif11.append([x1,y1,l])
trif12.append([x,y,0])
trif12.append([x1,y1,l])
trif12.append([x,y,l])
qua3 = a3.art3d.Poly3DCollection(trif11,facecolors=coloref, linewidths=spessore, alpha=trasp)
qua4 = a3.art3d.Poly3DCollection(trif12,facecolors=coloref, linewidths=spessore, alpha=trasp)
spazio.add_collection(qua3)
spazio.add_collection(qua4)
#faccia 2
trif21.append([x1,y1,0])
trif21.append([x2,y2,0])
trif21.append([x2,y2,l])
trif22.append([x1,y1,0])
trif22.append([x2,y2,l])
trif22.append([x1,y1,l])
qua5 = a3.art3d.Poly3DCollection(trif21,facecolors=coloref, linewidths=spessore, alpha=trasp)
qua6 = a3.art3d.Poly3DCollection(trif22,facecolors=coloref, linewidths=spessore, alpha=trasp)
spazio.add_collection(qua5)
spazio.add_collection(qua6)
#faccia 3
trif31.append([x2,y2,0])
trif31.append([x3,y3,0])
trif31.append([x2,y2,l])
trif32.append([x2,y2,l])
trif32.append([x3,y3,l])
trif32.append([x3,y3,0])
qua7 = a3.art3d.Poly3DCollection(trif31,facecolors=coloref, linewidths=spessore, alpha=trasp)
qua8 = a3.art3d.Poly3DCollection(trif32,facecolors=coloref, linewidths=spessore, alpha=trasp)
spazio.add_collection(qua7)
spazio.add_collection(qua8)
#faccia 4
trif41.append([x3,y3,0])
trif41.append([x,y,0])
trif41.append([x3,y3,l])
trif42.append([x,y,l])
trif42.append([x,y,l])
trif42.append([x3,y3,0])
qua9 = a3.art3d.Poly3DCollection(trif41,facecolors=coloref, linewidths=spessore, alpha=trasp)
qua10 = a3.art3d.Poly3DCollection(trif42,facecolors=coloref, linewidths=spessore, alpha=trasp)
spazio.add_collection(qua9)
spazio.add_collection(qua10)
#base su
trib21.append([x,y,l])
trib21.append([x1,y1,l])
trib21.append([x2,y2,l])
trib22.append([x,y,l])
trib22.append([x2,y2,l])
trib22.append([x3,y3,l])
qua11 = a3.art3d.Poly3DCollection(trib21,facecolors=coloref, linewidths=spessore, alpha=trasp)
qua12 = a3.art3d.Poly3DCollection(trib22,facecolors=coloref, linewidths=spessore, alpha=trasp)
spazio.add_collection(qua11)
spazio.add_collection(qua12)