// 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  <0.0, 2, -4.0>*20
  direction 1.5*z
  right     x*image_width/image_height
  look_at   <0.0, 0.0,  0.0>
  angle 7
}

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;
 
#declare rr     =function{sqrt(x*x+y*y+z*z)}
#declare thetar =function{atan2(y,sqrt(x*x+z*z))}
#declare phir   =function{atan2(z,x)}
//spherical bessel functions
#declare j0 =function(r){sin(abs(r))/abs(r+1e-9)}
#declare j1 =function(r){(sin(r)-r*cos(r))/(r*r)}
#declare j2 =function(r){((3-r*r)*sin(r)-3*r*cos(r))/(r*r*r)   }
#declare j3 =function(r){( r*(r*r-15)*cos(r)+3*(5-2*r*r)*sin(r) )/(r*r*r*r)}
     //maxima a_ln  (rough estimates)
#declare a00=0;     #declare a01=4.5;   #declare a02=7.75;  #declare a03=10.8;    //max @ origin... 
#declare a10=2.1;   #declare a11=5.95;  #declare a12=9.1;   //#declare a13=?;      
#declare a20=3.45;  #declare a21=7.4;   #declare a22=10.6;  //#declare a23=?;      
#declare a30=4.55;  #declare a31=8.6;   //#declare a32=?;  #declare a33=?;      
// assoc legendra poly's for theta  P_lm(cos(theta))
#declare p00 =function(q){1}
#declare p10 =function(q){cos(q)}
#declare p11 =function(q){sin(q)}
#declare p20 =function(q){.5*(3*cos(q)*cos(q)-1)}
#declare p21 =function(q){3*cos(q)*sin(q)}
#declare p22 =function(q){3*sin(q)*sin(q)}
#declare p30 =function(q){.5*(5*cos(q)*cos(q)*cos(q)-3*cos(q))}
#declare p31 =function(q){1.5*(5*cos(q)*cos(q)-1)*sin(q)}
#declare p32 =function(q){15*cos(q)*sin(q)*sin(q)}
#declare p33 =function(q){15*sin(q)*sin(q)*sin(q)}
 //sphere{0,1.3 pigment{color rgb .8}}

/*mode 010  */

#declare Amp=.5;       //color
#declare Amp_r=.2;      //surface distortion
#declare max_grad=54;
#declare f=.1*a10/a10;
#declare  S1 = function {Amp*cos(2*pi*f*lclock)*j1(rr(x,y,z)*a10)*p10(thetar(x,y,z))*cos(0*phir(x,y,z))}
#declare  S1r = function {Amp_r*cos(2*pi*f*lclock)*p10(thetar(x,y,z))*cos(0*phir(x,y,z))}
#declare R=1;

#declare wedgie=110*(trans(lclock-4)-trans(lclock-8));
#declare woffset=.15;
#declare R=1;
#if(wedgie<.1)
       #declare woffset=10;   
#end
difference{
     isosurface {
       function { sqrt(x*x + y*y + z*z - (R+S1r(x,y,z))*(R+S1r(x,y,z))) }
             accuracy 0.001
             max_gradient max_grad
             contained_by{sphere{0,1.3}}
     }       
     object{Wedge(wedgie) scale <1,1,-1> rotate y*wedgie/2 translate -woffset*z }
  texture {
    pigment {
     function{.5+S1(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 .4
    } 
  }
    no_shadow no_reflection
 translate -3*x+3*y
}

/*mode 011  */

#declare Amp=.5;       //color
#declare Amp_r=.1;      //surface distortion
#declare max_grad=54;
#declare f=.1*a10/a10;
#declare  S2 = function {Amp*cos(2*pi*f*lclock)*j1(rr(x,y,z)*a10)*p11(thetar(x,y,z))*cos(1*phir(x,y,z))}
#declare  S2r = function {Amp_r*cos(2*pi*f*lclock)*p11(thetar(x,y,z))*cos(1*phir(x,y,z))}
#declare R=1;

#declare wedgie=110*(trans(lclock-4)-trans(lclock-8));
#declare woffset=.15;
#declare R=1;
#if(wedgie<.1)
       #declare woffset=10;   
#end
difference{
     isosurface {
       function { sqrt(x*x + y*y + z*z - (R+S2r(x,y,z))*(R+S2r(x,y,z))) }
             accuracy 0.001
             max_gradient max_grad
             contained_by{sphere{0,1.3}}
     }       
     object{Wedge(wedgie) scale <1,1,-1> rotate y*wedgie/2 translate -woffset*z }
  texture {
    pigment {
     function{.5+S2(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 .4
    } 
  }
    no_shadow no_reflection
 translate -0*x+3*y
}

/*mode 110  */

#declare Amp=1.0;       //color
#declare Amp_r=.05;      //surface distortion
#declare max_grad=54;
#declare f=.1*a11/a10;
#declare  S3 = function {Amp*cos(2*pi*f*lclock)*j1(rr(x,y,z)*a11)*p10(thetar(x,y,z))*cos(0*phir(x,y,z))}
#declare  S3r = function {Amp_r*cos(2*pi*f*lclock)*p10(thetar(x,y,z))*cos(0*phir(x,y,z))}
#declare R=1;

#declare wedgie=110*(trans(lclock-4)-trans(lclock-8));
#declare woffset=.15;
#declare R=1;
#if(wedgie<.1)
       #declare woffset=10;   
#end
difference{
     isosurface {
       function { sqrt(x*x + y*y + z*z - (R+S3r(x,y,z))*(R+S3r(x,y,z))) }
             accuracy 0.001
             max_gradient max_grad
             contained_by{sphere{0,1.3}}
     }       
     object{Wedge(wedgie) scale <1,1,-1> rotate y*wedgie/2 translate -woffset*z }
  texture {
    pigment {
     function{.5+S3(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 .4
    } 
  }
    no_shadow no_reflection
 translate 3*x+3*y
}

/*mode 111  */

#declare Amp=1.2;       //color
#declare Amp_r=.075;      //surface distortion
#declare max_grad=54;
#declare f=.1*a11/a10;
#declare  S4 = function {Amp*cos(2*pi*f*lclock)*j1(rr(x,y,z)*a11)*p11(thetar(x,y,z))*cos(1*phir(x,y,z))}
#declare  S4r = function {Amp_r*cos(2*pi*f*lclock)*p11(thetar(x,y,z))*cos(1*phir(x,y,z))}
#declare R=1;

#declare wedgie=110*(trans(lclock-4)-trans(lclock-8));
#declare woffset=.15;
#declare R=1;
#if(wedgie<.1)
       #declare woffset=10;   
#end
difference{
     isosurface {
       function { sqrt(x*x + y*y + z*z - (R+S4r(x,y,z))*(R+S4r(x,y,z))) }
             accuracy 0.001
             max_gradient max_grad
             contained_by{sphere{0,1.3}}
     }       
     object{Wedge(wedgie) scale <1,1,-1> rotate y*wedgie/2 translate -woffset*z }
  texture {
    pigment {
     function{.5+S4(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 .4
    } 
  }
    no_shadow no_reflection
 translate -3*x+0*y
}

/*mode 210  */

#declare Amp=.9;       //color
#declare Amp_r=.05;      //surface distortion
#declare max_grad=54;
#declare f=.1*a12/a10;
#declare  S5 = function {Amp*cos(2*pi*f*lclock)*j1(rr(x,y,z)*a12)*p10(thetar(x,y,z))*cos(0*phir(x,y,z))}
#declare  S5r = function {Amp_r*cos(2*pi*f*lclock)*p10(thetar(x,y,z))*cos(0*phir(x,y,z))}
#declare R=1;

#declare wedgie=110*(trans(lclock-4)-trans(lclock-8));
#declare woffset=.15;
#declare R=1;
#if(wedgie<.1)
       #declare woffset=10;   
#end
difference{
     isosurface {
       function { sqrt(x*x + y*y + z*z - (R+S5r(x,y,z))*(R+S5r(x,y,z))) }
             accuracy 0.001
             max_gradient max_grad
             contained_by{sphere{0,1.3}}
     }       
     object{Wedge(wedgie) scale <1,1,-1> rotate y*wedgie/2 translate -woffset*z }
  texture {
    pigment {
     function{.5+S5(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 .4
    } 
  }
    no_shadow no_reflection
 translate -0*x+0*y
}

/*mode 020  */

#declare Amp=1.2;       //color
#declare Amp_r=.075;      //surface distortion
#declare max_grad=54;
#declare f=.1*a20/a10;
#declare  S6 = function {Amp*cos(2*pi*f*lclock)*j2(rr(x,y,z)*a20)*p20(thetar(x,y,z))*cos(0*phir(x,y,z))}
#declare  S6r = function {Amp_r*cos(2*pi*f*lclock)*p20(thetar(x,y,z))*cos(0*phir(x,y,z))}
#declare R=1;

#declare wedgie=110*(trans(lclock-4)-trans(lclock-8));
#declare woffset=.15;
#declare R=1;
#if(wedgie<.1)
       #declare woffset=10;   
#end
difference{
     isosurface {
       function { sqrt(x*x + y*y + z*z - (R+S6r(x,y,z))*(R+S6r(x,y,z))) }
             accuracy 0.001
             max_gradient max_grad
             contained_by{sphere{0,1.3}}
     }       
     object{Wedge(wedgie) scale <1,1,-1> rotate y*wedgie/2 translate -woffset*z }
  texture {
    pigment {
     function{.5+S6(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 .4
    } 
  }
    no_shadow no_reflection
 translate 3*x+0*y
}

/*mode 120  */

#declare Amp=1.5;       //color
#declare Amp_r=.15;      //surface distortion
#declare max_grad=54;
#declare f=.1*a12/a10;
#declare  S7 = function {Amp*cos(2*pi*f*lclock)*j2(rr(x,y,z)*a21)*p20(thetar(x,y,z))*cos(0*phir(x,y,z))}
#declare  S7r = function {Amp_r*cos(2*pi*f*lclock)*p20(thetar(x,y,z))*cos(0*phir(x,y,z))}
#declare R=1;

#declare wedgie=110*(trans(lclock-4)-trans(lclock-8));
#declare woffset=.15;
#declare R=1;
#if(wedgie<.1)
       #declare woffset=10;   
#end
difference{
     isosurface {
       function { sqrt(x*x + y*y + z*z - (R+S7r(x,y,z))*(R+S7r(x,y,z))) }
             accuracy 0.001
             max_gradient max_grad
             contained_by{sphere{0,1.3}}
     }       
     object{Wedge(wedgie) scale <1,1,-1> rotate y*wedgie/2 translate -woffset*z }
  texture {
    pigment {
     function{.5+S7(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 .4
    } 
  }
    no_shadow no_reflection
 translate -3*x-3*y
}
       
/*mode 122  */

#declare Amp=.6;       //color
#declare Amp_r=.05;      //surface distortion
#declare max_grad=54;
#declare f=.1*a12/a10;
#declare  S8 = function {Amp*cos(2*pi*f*lclock)*j2(rr(x,y,z)*a21)*p22(thetar(x,y,z))*cos(2*phir(x,y,z))}
#declare  S8r = function {Amp_r*cos(2*pi*f*lclock)*p22(thetar(x,y,z))*cos(2*phir(x,y,z))}
#declare R=1;

#declare wedgie=110*(trans(lclock-4)-trans(lclock-8));
#declare woffset=.15;
#declare R=1;
#if(wedgie<.1)
       #declare woffset=10;   
#end
difference{
     isosurface {
       function { sqrt(x*x + y*y + z*z - (R+S8r(x,y,z))*(R+S8r(x,y,z))) }
             accuracy 0.001
             max_gradient 276
             contained_by{sphere{0,1.3}}
     }       
     object{Wedge(wedgie) scale <1,1,-1> rotate y*wedgie/2 translate -woffset*z }
  texture {
    pigment {
     function{.5+S8(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 .4
    } 
  }
    no_shadow no_reflection
 translate -0*x-3*y
}
       
       
/*mode 222  */

#declare Amp=.7;
#declare Amp_r=.04;
#declare max_grad=70;
#declare f=.1*a22/a10;
#declare  S9 = function {Amp*cos(2*pi*f*lclock)*j2(rr(x,y,z)*a22)*p22(thetar(x,y,z))*cos(2*phir(x,y,z))}
#declare  S9r = function {Amp_r*cos(2*pi*f*lclock)*p22(thetar(x,y,z))*cos(2*phir(x,y,z))}
#declare R=1;

#declare wedgie=110*(trans(lclock-4)-trans(lclock-8));
#declare woffset=.15;
#declare R=1;
#if(wedgie<.1)
       #declare woffset=10;   
#end
difference{
     isosurface {
       function { sqrt(x*x + y*y + z*z - (R+S9r(x,y,z))*(R+S9r(x,y,z))) }
             accuracy 0.001
             max_gradient 443
             contained_by{sphere{0,1.4}}
     }       
     object{Wedge(wedgie) scale <1,1,-1> rotate y*wedgie/2 translate -woffset*z }
  texture {
    pigment {
     function{.5+S9(x,y,z)}
      color_map {
        [0.00 color rgb <1.0,0.0,0.0> ]
        [0.45 color rgb <.8,.2,.1> ]
        [0.50 color rgb <.1,.1,.1> ]
        [0.55 color rgb <.1,.2,.8> ]
        [1.00 color rgb <0,0.0,1> ]
      }
    
    }

    finish{
      specular 0.2    ambient .4
    } 
  }
      no_shadow no_reflection
 translate 3*x-3*y
}


/*mode 220 
#declare Amp=.68;
#declare Amp_r=.025;
#declare max_grad=53;
#declare f=a22/a10;

#declare  S1 = function {Amp*cos(2*pi*f*lclock)*j2(rr(x,y,z)*a22)*p20(thetar(x,y,z))*cos(0*phir(x,y,z))}
#declare  S1r = function {Amp_r*cos(2*pi*f*lclock)*p20(thetar(x,y,z))*cos(0*phir(x,y,z))}

#declare R=1;

#declare wedgie=110*(trans(lclock-4)-trans(lclock-8));
#declare woffset=.15;
#declare R=1;
#if(wedgie<.1)
       #declare woffset=10;   
#end
difference{
     isosurface {
       function { sqrt(x*x + y*y + z*z - (R+S1r(x,y,z))*(R+S1r(x,y,z))) }
             accuracy 0.001
             max_gradient max_grad
             contained_by{sphere{0,1.4}}
     }       
     object{Wedge(wedgie) scale <1,1,-1> rotate y*wedgie/2 translate -woffset*z }
  texture {
    pigment {
     function{.5+S1(x,y,z)}
      color_map {
        [0.00 color rgb <1.0,0.0,0.0> ]
        [0.45 color rgb <.8,.2,.1> ]
        [0.50 color rgb <.1,.1,.1> ]
        [0.55 color rgb <.1,.2,.8> ]
        [1.00 color rgb <0,0.0,1> ]
      }
    
    }

    finish{
      specular 0.2    ambient .4
    } 
  }
    no_shadow
 //rotate x*180
}

*/