The bicubic patch

Bicubic patch

POV-Ray 3.5 source bicubic.pov:

global_settings { assumed_gamma 1.0 }

background { rgb 1 }

camera {
  location <3.2,5,-8>
  look_at <3,-1.5,1.5> angle 55
  up y right 2*x
}
light_source {<500,500,-500> rgb 1 }

#declare B11=<0,0,3>; #declare B12=<1,0,3>; //
#declare B13=<2,0,3>; #declare B14=<3,0,3>; // row 1

#declare B21=<0,0,2>; #declare B22=<1,0,2>; //
#declare B23=<2,0,2>; #declare B24=<3,1,2>; // row 2

#declare B31=<0,0,1>; #declare B32=<1,0,1>; //
#declare B33=<2.5,-1,1>; #declare B34=<3.15,.25,1>; // row 3

#declare B41=<0,.25,0>; #declare B42=<1,0,0>; //
#declare B43=<2,0,0>; #declare B44=<3,.25,0>; // row 4


bicubic_patch {
   type 1 flatness 0.001
   u_steps 4 v_steps 4
   uv_vectors
   <0,0> <1,0> <1,1> <0,1>
   B11, B12, B13, B14
   B21, B22, B23, B24
   B31, B32, B33, B34
   B41, B42, B43, B44
   uv_mapping
   texture {
      pigment {
         checker 
         color rgbf <1,1,1,0.5> 
         color rgbf <0,0,1,0.7> 
         scale 1/3
      }
      finish {phong 0.6 phong_size 20}
   }
   no_shadow
}

#declare R12=B14+(B14-B13); 
#declare R22=B24+(B24-B23); 
#declare R32=B34+(B34-B33); 
#declare R42=B44+(B44-B43); 

#declare R11=B14;
#declare R13=<5,0,3>; #declare R14=<6,0,3>; // row 1

#declare R21=B24;
#declare R23=<5,0,2>; #declare R24=<6,0,2>; // row 2

#declare R31=B34;
#declare R33=<5,0,1>; #declare R34=<6,0,1>; // row 3

#declare R41=B44;
#declare R43=<5,0,0>; #declare R44=<6,0,0>; // row 4

bicubic_patch {
   type 1 flatness 0.001
   u_steps 4 v_steps 4
   uv_vectors
   <0,0> <1,0> <1,1> <0,1>
   R11, R12, R13, R14
   R21, R22, R23, R24
   R31, R32, R33, R34
   R41, R42, R43, R44
   uv_mapping
   texture {
      pigment {
         checker 
         color rgbf <1,1,1,0.5> 
         color rgbf <1,0,0,0.7> 
         scale 1/3
      }
      finish {phong 0.6 phong_size 20}
   }
   no_shadow
}

#declare G11=B41;      #declare G12=B42;                //
#declare G13=B43;      #declare G14=B44;                // row 1

#declare G21=B41+(B41-B31); #declare G22=B42+(B42-B32); //
#declare G23=B43+(B43-B33); #declare G24=B44+(B44-B34); // row 2

#declare G31=<0,0,-2>; #declare G32=<1,0,-2>;           //
#declare G33=<2,0,-2>; #declare G34=<3,2,-2>;           // row 3

#declare G41=<0,0,-3>; #declare G42=<1,0,-3>;           // 
#declare G43=<2,0,-3>; #declare G44=<3,0,-3>;           // row 4

bicubic_patch {
   type 1 flatness 0.001
   u_steps 4 v_steps 4
   uv_vectors
   <0,0> <1,0> <1,1> <0,1>
   G11, G12, G13, G14
   G21, G22, G23, G24
   G31, G32, G33, G34
   G41, G42, G43, G44
   uv_mapping
   texture {
      pigment {
         checker 
         color rgbf <1,1,1,0.5> 
         color rgbf <0,1,0,0.7> 
         scale 1/3
      }
      finish {phong 0.6 phong_size 20}
   }
   no_shadow
}

#declare Y11=R41;      #declare Y12=R42;
#declare Y13=R43;      #declare Y14=R44;                // row 1

#declare Y21=R41+(R41-R31); #declare Y22=R42+(R42-R32);
#declare Y23=R43+(R43-R33); #declare Y24=R44+(R44-R34); // row 2

#declare Y31=G34;      #declare Y32=G34+(G34-G33);
#declare Y33=<5,0,-2>; #declare Y34=<6,0,-2>;           // row 3

#declare Y41=G44;      #declare Y42=G44+(G44-G43);
#declare Y43=<5,0,-3>; #declare Y44=<6,0,-3>;           // row 4

bicubic_patch {
   type 1 flatness 0.001
   u_steps 4 v_steps 4
   uv_vectors
   <0,0> <1,0> <1,1> <0,1>
   Y11, Y12, Y13, Y14
   Y21, Y22, Y23, Y24
   Y31, Y32, Y33, Y34
   Y41, Y42, Y43, Y44
   uv_mapping
   texture {
      pigment {
         checker 
         color rgbf <1,1,1,0.5> 
         color rgbf <1,1,0,0.7> 
         scale 1/3
      }
      finish {phong 0.6 phong_size 20}
   }
   no_shadow
}

#declare Points=array[9]{B33,B34,R32,B43,B44,R42,G23,G24,Y22}
#declare I=0;
#while (I<9)
   sphere {
      Points[I],0.1 
      no_shadow 
      pigment{
         #if (I=4)
            color rgb <1,0,0>
         #else
            color rgb <0,1,1>
         #end
      }
   }
   #declare I=I+1;
#end
union {
   cylinder {B33,B34,0.04} cylinder {B34,R32,0.04}
   cylinder {B43,B44,0.04} cylinder {B44,R42,0.04}
   cylinder {G23,G24,0.04} cylinder {G24,Y22,0.04}
   cylinder {B33,B43,0.04} cylinder {B43,G23,0.04}
   cylinder {B34,B44,0.04} cylinder {B44,G24,0.04}
   cylinder {R32,R42,0.04} cylinder {R42,Y22,0.04}
   no_shadow 
   pigment {color rgb <1,1,0>}
}