// Persistence of Vision Ray Tracer Scene Description File // File: Fourier3D.pov // Vers: 3.5 // Desc: isosurface of Fourier-Series // Date: 28.02.2002 // Auth: Thies Heidecke //#include "functions.inc" global_settings { assumed_gamma 2.2 } #default { texture { pigment { color rgb 1} finish { ambient 0 diffuse .85 } } } /* camera { location 3.5*<2.0, 4.0, -5.0> look_at <0.0, 0.0, 0.0> angle 10 right x*image_width/image_height up y } */ // orthographic projection using parallel camera rays // Could be used to render a planar image map, for example camera { orthographic right 32*image_width/image_height*x up 32*y location <0,15,-5> look_at <0,15,0> } light_source { 0*x // light's position (translated below) color rgb .5 // light's color translate <-40, 0, 10> } light_source { 0*x // light's position (translated below) color rgb .8 // light's color translate <40, 20, -30> } #declare cosknot = function {-cos(pi*x)-cos(pi*y)-cos(pi*z)} #declare sinknot = function {-sin(pi*x)-sin(pi*y)-sin(pi*z)} #macro Fourier3D(N) #while(N>0) /* Square 1: (1/(4*N-3))*cosknot((4*N-3)*x,(4*N-3)*y,(4*N-3)*z) - (1/(4*N-1))*cosknot((4*N-1)*x,(4*N-1)*y,(4*N-1)*z) + */ /* Square 2: (1/(2*N-1))*sinknot((2*N-1)*x,(2*N-1)*y,(2*N-1)*z) + */ /* Triangle: (1/(4*N*(N-1)+1))*cosknot((2*N-1)*x,(2*N-1)*y,(2*N-1)*z) + */ /* Parabol 1: (1/(4*N*(N-1)+1))*cosknot((2*N-1)*x,(2*N-1)*y,(2*N-1)*z) - (1/(4*N*N))*cosknot((2*N)*x,(2*N)*y,(2*N)*z) + */ /* Sphere: -1/(N*N)*cosknot(N*(x-1),N*(y-1),N*(z-1)) + */ /* Misc1 (interesting rough structure): (1/(4*N*(N-1)+1))*cosknot((4*N*(N-1)+1)*x,(4*N*(N-1)+1)*y,(4*N*(N-1)+1)*z) + */ /* Misc2 (looks like superellipsoid): -exp(1-N)*cosknot(N*(x-1),N*(y-1),N*(z-1)) + */ (1/(4*N*(N-1)+1))*cosknot((4*N*(N-1)+1)*x,(4*N*(N-1)+1)*y,(4*N*(N-1)+1)*z) + #local N=N-1; #end 0 #end #macro Fourier3D_Square1(N) #local C=N; #while(C>0) // Square 1: //#if(mod(C,2)=1) (1/(4*C-3))*cosknot((4*C-3)*x,(4*C-3)*y,(4*C-3)*z) - //#else (1/(4*C-1))*cosknot((4*C-1)*x,(4*C-1)*y,(4*C-1)*z) + //#end #local C=C-1; #end 0 #end #macro Fourier3D_Square2(N) #local C=N; #while(C>0) // Square 2: (1/(2*C-1))*sinknot((2*C-1)*x,(2*C-1)*y,(2*C-1)*z) + #local C=C-1; #end 0 #end #macro Fourier3D_Triangle(N) #local C=N; #while(C>0) // Triangle: (1/(4*C*(C-1)+1))*cosknot((2*C-1)*x,(2*C-1)*y,(2*C-1)*z) + #local C=C-1; #end 0 #end #macro Fourier3D_Parabol(N) #local C=N; #while(C>0) // Parabol 1: #if(mod(C,2)=1) (1/(4*C*(C-1)+1))*cosknot((2*C-1)*x,(2*C-1)*y,(2*C-1)*z) - #else (1/(4*C*C))*cosknot((2*C)*x,(2*C)*y,(2*C)*z) + #end #local C=C-1; #end 0 #end #macro Fourier3D_Sphere(N) #local C=N; #while(C>0) // Sphere: -1/(C*C)*cosknot(C*(x-1),C*(y-1),C*(z-1)) + #local C=C-1; #end 0 #end #macro Fourier3D_Misc1(N) #local C=N; #while(C>0) // Misc1 (looks like superellipsoid): -exp(1-C)*cosknot(C*(x-1),C*(y-1),C*(z-1)) + #local C=C-1; #end 0 #end #macro Fourier3D_Misc2(N) #local C=N; #while(C>0) // Misc2 (interesting rough structure): (1/(4*C*(C-1)+1))*cosknot((4*C*(C-1)+1)*x,(4*C*(C-1)+1)*y,(4*C*(C-1)+1)*z) + #local C=C-1; #end 0 #end //* #declare depth=1; #declare maxd =10; #while(depth<=maxd) union { isosurface { function { Fourier3D_Square1(depth) } contained_by { box { -1, 1 } } //threshold 0.0 accuracy 0.001 max_gradient 40 rotate 45*y rotate 45*x translate 3*(-3)*x } isosurface { function { Fourier3D_Square2(depth) } contained_by { box { -1, 1 } } //threshold 0.0 accuracy 0.001 max_gradient 40 rotate 45*y rotate 45*x translate 3*-2*x } isosurface { function { Fourier3D_Triangle(depth) } contained_by { box { -1, 1 } } //threshold 0.0 accuracy 0.001 max_gradient 20 rotate 45*y rotate 45*x translate 3*-1*x } isosurface { function { Fourier3D_Parabol(depth) } contained_by { box { -1, 1 } } //threshold 0.0 accuracy 0.001 max_gradient 20 rotate 45*y rotate 45*x translate 3*0*x } isosurface { function { Fourier3D_Sphere(depth) } contained_by { box { -1, 1 } } //threshold 0.0 accuracy 0.001 max_gradient 10 rotate 45*y rotate 45*x translate 3*1*x } isosurface { function { Fourier3D_Misc1(depth) } contained_by { box { -1, 1 } } //threshold 0.0 accuracy 0.001 max_gradient 10 rotate 45*y rotate 45*x translate 3*2*x } isosurface { function { Fourier3D_Misc2(depth) } contained_by { box { -1, 1 } } //threshold 0.0 accuracy 0.001 max_gradient 100 rotate 45*y rotate 45*x translate 3*3*x } translate 3*(depth-1)*y } #declare depth=depth+1; #end //*/