第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

為什么嘗試使用 Line3D 對(duì)象時(shí) matplotlib 3d 動(dòng)畫不起作用

為什么嘗試使用 Line3D 對(duì)象時(shí) matplotlib 3d 動(dòng)畫不起作用

慕田峪4524236 2023-10-26 14:20:45
我有這個(gè)代碼:import matplotlib.pyplot as plt import mpl_toolkits.mplot3d.axes3d as plt3dimport mpl_toolkits.mplot3d.art3d as artplt3dimport matplotlib.animation as animationimport numpy as npimport math def animateBeta():    def translate(segment_, xTr_, yTr_, zTr_):        translationMatrix = np.array([            [1, 0, xTr_],            [0, 1, yTr_],            [0, 0, zTr_]        ])        return np.matmul(translationMatrix, segment_)    def rotate(vec_, xRotate_, yRotate_, zRotate_):        xMat = np.array([            [1,0,0],            [0,math.cos(xRotate_), -math.sin(xRotate_)],            [0, math.sin(xRotate_), math.cos(xRotate_)]        ])        yMat = np.array([            [math.cos(yRotate_), 0, math.sin(yRotate_)],            [0, 1, 0],            [-math.sin(yRotate_), 0, math.cos(yRotate_)]        ])        zMat = np.array([            [math.cos(zRotate_), -math.sin(zRotate_), 0],            [math.sin(zRotate_), math.cos(zRotate_), 0],            [0, 0, 1]        ])        rotationMatrix = np.matmul(zMat, np.matmul(yMat, xMat))        return np.matmul(rotationMatrix, vec_)    segment = [        [0,0],        [0,0],        [1, -1]    ]    fig = plt.figure()    ax = plt3d.Axes3D(fig)    line, = ax.plot(segment[0], segment[1], zs=segment[2], color = 'b')    artplt3d.line_2d_to_3d(line)    print(line.__class__)    def animate(i):        s0 = [0,0,1]        s1 = [0,0,-1]        s1 = translate(rotate(translate(s1, -s0[0], -s0[1], -s0[2]), -i*(math.pi/180),0,-i*(math.pi/180)), s0[0], s0[1], s0[2])        segment = np.concatenate((np.reshape(s0, (3,-1)),np.reshape(s1, (3,-1))), axis=1)當(dāng)使用注釋data = ax.plot(segment[0], segment[1], segment[2], color = 'b')行而不是以下兩行時(shí),它可以工作(但我試圖這樣做,以便在頂部繪制新行時(shí)不會(huì)繪制先前的行)。如果您按原樣使用代碼,則動(dòng)畫看起來很奇怪。我有一個(gè)理論并line_2d_to_3d沒有按預(yù)期發(fā)揮作用,但我不確定。
查看完整描述

1 回答

?
慕容3067478

TA貢獻(xiàn)1773條經(jīng)驗(yàn) 獲得超3個(gè)贊

好吧,我使用的是 ax.plot 而不是plot3D,我的印象是使用 ax.plot 時(shí)繪圖更正確



查看完整回答
反對(duì) 回復(fù) 2023-10-26
  • 1 回答
  • 0 關(guān)注
  • 148 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)