|
|
@ -33,8 +33,8 @@ class TkCube(object): |
|
|
|
radius = math.sqrt(2) # 点旋转的半径 |
|
|
|
for pair in [[0,4,-math.pi/4], |
|
|
|
[1,5,math.pi/4], |
|
|
|
[2,6,math.pi*3/4], |
|
|
|
[3,7,-math.pi*3/4]]: # rotate in pairs |
|
|
|
[2,6,-math.pi*3/4], |
|
|
|
[3,7,math.pi*3/4]]: # rotate in pairs |
|
|
|
center = [radius*math.sin(self.angle+pair[2]),radius*math.cos(self.angle+pair[2])] |
|
|
|
# x |
|
|
|
self.points[pair[0]][0] = center[0] |
|
|
@ -50,17 +50,10 @@ class TkCube(object): |
|
|
|
self.pit[pt][0] = self.points[pt][0]*rate*scale |
|
|
|
self.pit[pt][1] = self.points[pt][2]*rate*scale |
|
|
|
self.cvs[self.hiddenCv].delete('all') |
|
|
|
# for dcp,nps in [[1,[0,3,5]], # drawing central point:以1,2,4,7四个点为中心,分别连接相邻的三个点即可绘成正方体 |
|
|
|
# [2,[0,3,6]], |
|
|
|
# [4,[0,5,6]], |
|
|
|
# [7,[3,5,6]]]: |
|
|
|
# 不知道为什么上面的画不出正确的正方体,底面是对角线不是棱┑( ̄Д  ̄)┍ |
|
|
|
for dcp,nps in [[1,[0,2,5]], # drawing central point:以1,2,4,7四个点为中心,分别连接相邻的三个点即可绘成正方体 |
|
|
|
[2,[1,3,6]], |
|
|
|
[0,[3]], |
|
|
|
[4,[0,5,7]], |
|
|
|
[7,[3,4,6]], |
|
|
|
[6,[5]]]: |
|
|
|
for dcp,nps in [[1,[0,3,5]], # drawing central point:以1,2,4,7四个点为中心,分别连接相邻的三个点即可绘成正方体 |
|
|
|
[2,[0,3,6]], |
|
|
|
[4,[0,5,6]], |
|
|
|
[7,[3,5,6]]]: |
|
|
|
for np in nps: # nearby point |
|
|
|
self.cvs[self.hiddenCv].create_line(self.pit[dcp][0]+400,self.pit[dcp][1]+300,self.pit[np][0]+400,self.pit[np][1]+300) # 因为坐标原点在左上角,让x和y分别加400和300让画面在窗口中心 |
|
|
|
# 切换canvas |
|
|
|