-----8<------parmtric.bat---- echo (a+cos(uu/2)*sin(vv)-sin(uu/2)*sin(2*vv))*cos(uu) >uuvv.x echo (a+cos(uu/2)*sin(vv)-sin(uu/2)*sin(2*vv))*sin(uu) >uuvv.y echo sin(uu/2)*sin(vv)+cos(uu/2)*sin(2*vv) >uuvv.z -----8<------parmtric.ini---- Pre_Scene_Command =parmtric.bat Input_File_Name =parmtric.pov -----8<------parmtric.inc---- #declare surface = mesh { #declare iu = (umax-umin)/uiter //increment per step #declare iv = (vmax-vmin)/viter #declare counter = 0 #declare vv = vmin #while (vv<=vmax) //outer loop #declare uu = umin #while (uu<=umax) //inner loop //POINTS #declare x1=#include "uuvv.x" //Calculate the #declare y1=#include "uuvv.y" //four points in #declare z1=#include "uuvv.z" //the rectangle defined #declare uu=uu+iu //by uu,uu+iu,vv,vv+iv #declare x2=#include "uuvv.x" //Uses uu and vv because #declare y2=#include "uuvv.y" //u and v are built in #declare z2=#include "uuvv.z" //constants. #declare vv=vv+iv #declare x3=#include "uuvv.x" #declare y3=#include "uuvv.y" #declare z3=#include "uuvv.z" #declare uu=uu-iu #declare x4=#include "uuvv.x" #declare y4=#include "uuvv.y" #declare z4=#include "uuvv.z" #declare vv=vv-iv //NORMALS used for smoothing triangles #declare vv=vv-iv //Calculate surface normals #declare nx1=#include "uuvv.x" //to the nine rectangles in #declare ny1=#include "uuvv.y" //the immediate neighbourhood #declare nz1=#include "uuvv.z" #declare uu=uu+iu #declare nx2=#include "uuvv.x" #declare ny2=#include "uuvv.y" #declare nz2=#include "uuvv.z" #declare uu=uu+iu #declare vv=vv+iv #declare nx3=#include "uuvv.x" #declare ny3=#include "uuvv.y" #declare nz3=#include "uuvv.z" #declare vv=vv+iv #declare nx4=#include "uuvv.x" #declare ny4=#include "uuvv.y" #declare nz4=#include "uuvv.z" #declare vv=vv+iv #declare uu=uu-iu #declare nx5=#include "uuvv.x" #declare ny5=#include "uuvv.y" #declare nz5=#include "uuvv.z" #declare uu=uu-iu #declare nx6=#include "uuvv.x" #declare ny6=#include "uuvv.y" #declare nz6=#include "uuvv.z" #declare uu=uu-iu #declare vv=vv-iv #declare nx7=#include "uuvv.x" #declare ny7=#include "uuvv.y" #declare nz7=#include "uuvv.z" #declare vv=vv-iv #declare nx8=#include "uuvv.x" #declare ny8=#include "uuvv.y" #declare nz8=#include "uuvv.z" #declare uu=uu+iu //Here is where normals are calculated. #declare n1=vcross(,) #declare n2=vcross(,) #declare n3=vcross(,) #declare n4=vcross(,) #declare normal1=n1+n2+n3+n4 #declare n1=vcross(,) #declare n2=vcross(,) #declare n3=vcross(,) #declare n4=vcross(,) #declare normal2=n1+n2+n3+n4 #declare n1=vcross(,) #declare n2=vcross(,) #declare n3=vcross(,) #declare n4=vcross(,) #declare normal3=n1+n2+n3+n4 #declare n1=vcross(,) #declare n2=vcross(,) #declare n3=vcross(,) #declare n4=vcross(,) #declare normal4=n1+n2+n3+n4 //TRIANGLES smooth_triangle { , normal1, , normal2, , normal3 } smooth_triangle { , normal1, , normal3, , normal4 } #declare uu = uu+iu #end //inner loop #debug concat("Looping on ",str(counter,0,-1)," of ",str(viter,0,-1),"\n") #declare counter = counter + 1 #declare vv = vv+iv #end //outer loop } //mesh -----8<------parmtric.pov---- /* Pov3 Parametric equation template- */ #include "colors.inc" #include "stones.inc" #include "textures.inc" #version 3.0 global_settings { assumed_gamma 1.0 } /* Put any other constants in the eqns. here */ #declare uiter = 40 //Number of steps (lengthwise) #declare viter = 40 //and across. Edit these for better res. #declare a=2 //for 8klein #declare vmin = 0 //Endpoints in the #declare vmax = 2*pi //parametric rectangle. #declare umin = -pi/4 //I.e. min and max uu and vv #declare umax = 3*pi/2 //Simple textures for triangles #declare simple1 = texture{ pigment {checker color Gray60, color White} finish {ambient 0.2 specular 0.7 roughness 0.05 } scale 0.15 } #declare simple2 = texture{ pigment {color Green} finish {ambient 0.2 specular 0.7 roughness 0.05 } } //Lights, camera, action camera { location < 15, 9,-15> direction 1*z look_at < 0, 0, 0> } light_source { <-10, 29,-19> color rgb 1 } light_source { <23, 20, -15> color rgb 1 } object {box{-30,30 inverse}pigment{color rgb 0.8}} //OBJECT DECLARED HERE #include "paraloop.inc" //Returns a mesh named surface object{ surface texture{T_Stone18} rotate <90,0,0> //This is just changing the //rotate <0,180,0> //coordinate system. scale 3 }