Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there any way to advance time in offline website viewer, and keep it in one plot #19

Open
otmanon opened this issue Jul 9, 2020 · 2 comments

Comments

@otmanon
Copy link

otmanon commented Jul 9, 2020

Hi, I'm currently interested in having a mesh, and deforming it with time. The examples I've seen (using libigl with meshplot) , seem to not show the mesh object changing with time, but instead show snapshots of the mesh taken at a specific time.

What I'd like to do is have a mesh at the start of the simulation, run the simulation, and be able to see it deform in real time in the viewer. I can't seem to find any functionality for it in the source code, does it exist? Can you think of a workaround I could do instead?
Thanks

@skoch9
Copy link
Owner

skoch9 commented Jul 11, 2020

Hi,
you can update your plotted objects with the function p.update_object(vertices=new_v). A possible example of a plot that you describe then looks like this

import meshplot as mp
import time

p = mp.plot(v, f)

for i in range(100):
    v_new = run_simulation_step(v, f, ...)
    p.update_object(vertices=v_new)
    v = v_new
    time.sleep(0.1) # depending on how long your simulation step takes you want to wait for a little while

@bmahlbrand
Copy link

in the same vein, i'm curious about updating the wireframe of the plot for this purpose

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants