// Persistence of Vision Ray Tracer Scene Description File
// File: ?.pov
// Vers: 3.6
// Desc: Basic Scene Example
// Date: mm/dd/yy
// Auth: ?
//

#version 3.6;

#include "colors.inc"
// macros for generating various shapes
// 
#include "shapes.inc"
#include "mrg_misc3.inc"

global_settings {
  assumed_gamma 1.0
}

// ----------------------------------------

camera {
  location  <1.5, 2.5, -4.0>*24
  direction 1.5*z
  right     x*image_width/image_height
  look_at   <0.0, 0.0,  0.0>
  angle 7.5
}

light_source {
  <0, 0, 0>            // light's position (translated below)
  color rgb <1, 1, 1>  // light's color
  translate <-30, 50, -30>
}
#declare lclock=clock+0.0;
 

#declare Amp=.68;
#declare Amp_s=.75;

#declare R=1;
#declare f_0=.25;

#declare wedgie=110*(trans(lclock-4)-trans(lclock-8));
#declare woffset=.15;
#declare R=1;
#if(wedgie<.1)
       #declare woffset=10;
              
#end 
//modes are HALF integers
#macro boxer(nx,ny,nz,A)
     #local psi=function{sin(nx*pi*x)*sin(ny*pi*y)*sin(nz*pi*z)}
     #local ff=f_0*sqrt(nx*nx+ny*ny+nz*nz)/sqrt(3);
     #local amp=A*cos(2*pi*ff*lclock);
     difference{
          isosurface {
          function { max((x*x-1-amp*psi(x,y,z)),(y*y-1-amp*psi(x,y,z)),(z*z-1-amp*psi(x,y,z))) }
                  accuracy 0.0075
                 max_gradient 2.81
                  contained_by{sphere{0,1.8}}
          }       
          object{Wedge(wedgie) scale <1,1,-1> rotate y*wedgie/2 translate -woffset*z }
       texture {
         pigment {
          function{.5+.45*cos(2*pi*ff*lclock)*psi(x,y,z)}
           color_map {
             [0.00 color rgb <1.0,0.0,0.0> ]
             [0.40 color rgb <.8,.2,.1> ]
             [0.50 color rgb <.1,.1,.1> ]
             [0.60 color rgb <.1,.2,.8> ]
             [1.00 color rgb <0,0.0,1> ]
           }
         
         }
         finish{
           specular 0.2    ambient .64
         } 
       }
         no_shadow
      //rotate x*180
     }
#end     
#declare os=4;
object{boxer(.5,.5,.5,.125) translate os*(y-x)}
object{boxer(1.5,.5,.5,.125) translate os*(y-0)}
object{boxer(1.5,1.5,.5,.125) translate os*(y+x)}
object{boxer(1.5,1.5,1.5,.125) translate os*(0-x)}
object{boxer(2.5,0.5,0.5,.125) translate os*(0-0)}
object{boxer(2.5,1.5,0.5,.125) translate os*(0+x)}
object{boxer(2.5,2.5,0.5,.125) translate os*(-y-x)}
object{boxer(3.5,0.5,0.5,.125) translate os*(-y-0)}
object{boxer(3.5,2.5,1.5,.125) translate os*(-y+x)}

