<jupyter_start><jupyter_text>- let us avaluate a function of 3 variables on relatively large mesh<jupyter_code>T = 1.618033988749895
from numpy import sin,cos,pi
r = 4.77
zmin,zmax = -r,r
xmin,xmax = -r,r
ymin,ymax = -r,r
Nx,Ny,Nz = 80,80,80

x = np.linspace(xmin,xmax,Nx)
y = np.linspace(ymin,ymax,Ny)
z = np.linspace(zmin,zmax,Nz)
x,y,z = np.meshgrid(x,y,z,indexing='ij')

%time p = 2 - (cos(x + T*y) + cos(x - T*y) + cos(y + T*z) \
               + cos(y - T*z) + cos(z - T*x) + cos(z + T*x))

p3d_1 = k3d.marching_cubes(p,xmin=xmin,xmax=xmax,ymin=ymin,ymax=ymax, zmin=zmin, zmax=zmax,\
                           level=0.0)
plot += p3d_1
plot.display()

p3d_1.color = 0x114455<jupyter_output><empty_output><jupyter_text>- isolevel can be changed from Python side:<jupyter_code>p3d_1.level=-0.1
from ipywidgets import interact, interactive, fixed
import ipywidgets as widgets

@interact(l=widgets.FloatSlider(value=-.1,min=-3,max=1.1))
def g(l):
    p3d_1.level=-l<jupyter_output><empty_output><jupyter_text>- to avoid recentering one can disable camera auto fit:<jupyter_code>plot.camera_auto_fit = False
plot.grid_auto_fit = False<jupyter_output><empty_output><jupyter_text>- one can add other plots to the same scene:<jupyter_code>%%time
p =(x**2+y**2+z**2+2*y-1)*((x**2+y**2+z**2-2*y-1)**2-8*z**2)+16*x*z*(x**2+y**2+z**2-2*y-1)
plot += k3d.marching_cubes(p,xmin=xmin,xmax=xmax,ymin=ymin,ymax=ymax, zmin=zmin, zmax=zmax, level=0.0,color=0xff0000)
%%time 
p = x**2 + y**2 - z**2 -0.
plot += k3d.marching_cubes(p,xmin=xmin,xmax=xmax,ymin=ymin,ymax=ymax, zmin=zmin, zmax=zmax, level=0.0,color=0x00ff00)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1834862385321101, 'fraction_numerical': 0.05688073394495413, 'mean_word_length': 5.415686274509804, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '17179', 'license': 'MIT', 'n_tokens_mistral': 828, 'n_tokens_neox': 786, 'n_words': 121, 'path': 'examples/SageDays74/implicit_plot3d_interactive.ipynb', 'repo_name': 'pevers/K3D-jupyter', 'size': '1635'}