Note that in this case each time the dataset is transferred. (opposite to marching cubes plot)
import k3d
import numpy as np
from ipywidgets import interact, interactive, fixed
import ipywidgets as widgets
import time
plot = k3d.plot()
Nx = 264
Ny = 264
xmin,xmax = -3,3
ymin,ymax = 0,3
x = np.linspace(xmin,xmax,Nx)
y = np.linspace(ymin,ymax,Ny)
x,y = np.meshgrid(x,y,indexing='ij')
surface = k3d.surface(np.sin(x**2+y**2),xmin=xmin,xmax=xmax,ymin=ymin,ymax=ymax,\
color=int(np.random.randint(0, 0xFFFFFF, 1)[0]))
plot += surface
plot.camera_auto_fit = False
plot.grid_auto_fit = False
/Users/marcin/anaconda3/lib/python3.7/site-packages/traittypes/traittypes.py:101: UserWarning: Given trait value dtype "float64" does not match required type "float32". A coerced copy has been created. np.dtype(self.dtype).name))
surface.heights = (np.sin(x**2)+np.cos(y**3))
surface.color=0xff0000
@interact(phi=widgets.FloatSlider(value=0.,min=0,max=2*np.pi,step=0.1))
def g(phi):
f = np.sin(x**2+y**2-phi)
surface.heights = f
interactive(children=(FloatSlider(value=0.0, description='phi', max=6.283185307179586), Output()), _dom_classe…
plot.display()
Output()
%time data = (np.sin(x**2)+np.cos(y**3))
%time surface.heights = data+2