In [ ]:
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
In [ ]:
surface.heights = (np.sin(x**2)+np.cos(y**3))
In [ ]:
surface.color=0xff0000
In [ ]:
@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
In [ ]:
plot.display()
In [ ]:
%time data = (np.sin(x**2)+np.cos(y**3))
In [ ]:
%time surface.heights = data+2
In [ ]: