Skip to content
Snippets Groups Projects
Commit 483c5b99 authored by Neil Gershenfeld's avatar Neil Gershenfeld
Browse files

wip

parent 50d194b1
No related branches found
No related tags found
No related merge requests found
......@@ -85,6 +85,8 @@
<a href=glimage.c>glimage.c</a>, <a href=glimage.mp4>video</a>, <a href=glsurf.c>glsurf.c<a/>, <a href=glsurf.mp4>video</a>
$ gcc glsurf.c -o glsurf -lm -lGL -lGLU -lglut
<a href=glimage.py>glimage.py</a>, <a href=glsurf.py>glsurf.py<a/>
<a href=https://www.w3.org/TR/webgpu/>WebGPU</a> <a href=https://github.com/pygfx/wgpu-py>wgpu-py</a> <a href=https://github.com/pygfx/pygfx>pygfx</a>
<a href=programs/pygfxsurf.py>pygfxsurf.py</a> <a href=programs/pygfxsurf.mp4>video</a>
<a href=http://renderman.pixar.com/view/non-commercial-renderman>RenderMan</a>, <a href=http://cgkit.sourceforge.net/>cgkit</a>
<a href=http://www.vtk.org/>VTK</a>, <a href=http://www.vtk.org/Wiki/VTK/Writing_VTK_files_using_python>pyvtk</a>, <a href=http://docs.enthought.com/mayavi/mayavi/>Mayavi</a>
<a href=https://www.paraview.org/>ParaView</a>
......
File added
interface_application_programming/programs/pygfxsurf.png

67.2 KiB

import pygfx as gfx
import numpy as np
l = 15.5
x = np.arange(-l,l,0.2)
y = np.arange(-l,l,0.2)
N = x.size
(x,y) = np.meshgrid(x,y)
r = np.sqrt(x**2+y**2)
r = np.reshape(r,N*N)
d = 100
scene = gfx.Scene()
surface = gfx.Mesh(
gfx.plane_geometry(2*d,2*d,N-1,N-1),
gfx.MeshStandardMaterial(color="#DDBB22",roughness=0.5,metalness=0.5,flat_shading=True),
)
surface.rotation.multiply(
gfx.linalg.Quaternion().set_from_euler(
gfx.linalg.Euler(-np.pi/2,0,0)))
scene.add(surface)
scene.add(gfx.AmbientLight(intensity=1))
light = gfx.objects.PointLight()
light.position.set(d,d,d)
scene.add(light)
k = 0
dk = 0.01
kmax = 1
dt = 0.01
def animate():
global k,dk
k += dk
if ((k > kmax) | (k < 0)):
dk = -dk
surface.rotation.multiply(
gfx.linalg.Quaternion().set_from_euler(
gfx.linalg.Euler(0,0,dt)))
surface.geometry.positions.data[:,2] = d*np.sin(k*r)/(k*r)
surface.geometry.positions.update_range(0,N*N)
gfx.show(scene,before_render=animate)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment