Skip to content

How to rotate the scene when I update the 3D scene by plt.render()? #755

Answered by marcomusy
CCHLENG asked this question in Q&A
Discussion options

You must be logged in to vote

This is only possible with vtk<9.2.2 due to a bug in vtk. Try

pip install vtk==9.0.3

then

from vedo import *

settings.allow_interaction = True

pts = np.random.uniform(10, 100, size=(100000, 3))
vpts = Points(pts, c='white', r=1)

plt = Plotter(axes=5, interactive=False, bg='black')
plt.show(vpts)

pb = ProgressBar(0,500, c='g')
for i in range(500):
    pts += np.random.randn(100000, 3)/20
    vpts.points(pts)

    cube_centers = np.random.uniform(10, 100, size=(10, 3))
    boxes=[]
    for cc in cube_centers:
        box = Box(size=(30,20,10), c='green5')
        ax, ay = np.random.uniform(0, 45, size=2)
        box.rotate_x(ax).rotate_y(ay).pos(cc)
        box.wireframe().lw(2).lighting(

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@CCHLENG
Comment options

Answer selected by CCHLENG
Comment options

You must be logged in to vote
1 reply
@CCHLENG
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants