/* Pov3 Parametric equation - Dini's surface of constant negative curvature. */ #version 3.0 global_settings { assumed_gamma 1.0 } #declare a=1 #declare b=0.2 #declare umin = 0 //endpoints in the #declare umax = 4*pi //parametric rectangle #declare vmin = 0.001 #declare vmax = 2 #declare uiter = 40 //number of steps #declare viter = 40 #declare iu = (umax-umin)/uiter //increment per step #declare iv = (vmax-vmin)/viter union{ #declare uu = umin #while (uu<=umax) //outer loop #declare vv = vmin #while (vv<=vmax) //inner loop //POINTS #declare x1=a*cos(uu)*sin(vv) //Calculate the #declare y1=a*sin(uu)*sin(vv) //four points in #declare z1=a*(cos(vv)+log(tan((vv/2))))+b*uu //the rectangle defined #declare uu=uu+iu //by uu,uu+iu,vv,vv+iv #declare x2=a*cos(uu)*sin(vv)//Uses uu and vv because #declare y2=a*sin(uu)*sin(vv) //u and v are built in #declare z2=a*(cos(vv)+log(tan((vv/2))))+b*uu //constants. #declare vv=vv+iv #declare x3=a*cos(uu)*sin(vv) #declare y3=a*sin(uu)*sin(vv) #declare z3=a*(cos(vv)+log(tan(vv/2)))+b*uu #declare uu=uu-iu #declare x4=a*cos(uu)*sin(vv) #declare y4=a*sin(uu)*sin(vv) #declare z4=a*(cos(vv)+log(tan(vv/2)))+b*uu #declare vv=vv-iv //NORMALS #declare uu=uu+2*iu //Calculate surface normals #declare nx1=a*cos(uu)*sin(vv)//to the nine rectangles in #declare ny1=a*sin(uu)*sin(vv) //the immediate neighbourhood #declare nz1=a*(cos(vv)+log(tan(vv/2)))+b*uu #declare uu=uu-2*iu #declare vv=vv+2*iv #declare nx2=a*cos(uu)*sin(vv) #declare ny2=a*sin(uu)*sin(vv) #declare nz2=a*(cos(vv)+log(tan(vv/2)))+b*uu #declare vv=vv-2*iv #declare uu=uu-iu #declare nx3=a*cos(uu)*sin(vv) #declare ny3=a*sin(uu)*sin(vv) #declare nz3=a*(cos(vv)+log(tan(vv/2)))+b*uu #declare uu=uu+iu #declare vv=vv-iv #declare nx4=a*cos(uu)*sin(vv) #declare ny4=a*sin(uu)*sin(vv) #declare nz4=a*(cos(vv)+log(tan(vv/2)))+b*uu #declare vv=vv+iv #declare n1=vcross(,) #declare n2=vcross(,) #declare n3=vcross(,) #declare n4=vcross(,) #declare n5=vcross(,) #declare n6=vcross(,) #declare n7=vcross(,) #declare n8=vcross(,) #declare n9=vcross(,) //CURVATURE as difference between normals // #declare ucur = vlength(vnormalize(n6)-vnormalize(n5))/2 // #declare vcur = vlength(vnormalize(n2)-vnormalize(n5))/2 //TRIANGLES object{ smooth_triangle{ ,n5+n6+n8+n9, ,n4+n5+n7+n8, ,n1+n2+n4+n5 } texture{ pigment {color rgb <0.1,0.8,0.2> //Fiddle colors for better result // <0.5+ucur*vcur*200,0.5-ucur*vcur*200,ucur/vcur-0.4> } finish { ambient 0.2 specular 0.7 roughness 0.05 } } } object{ smooth_triangle{ , n5+n6+n8+n9, , n1+n2+n4+n5 , n2+n3+n5+n6 } texture{ pigment{ color rgb <0.1,0.8,0.2> // <0.5+ucur*vcur*200,0.5-ucur*vcur*200 , ucur/vcur-0.4> } finish { ambient 0.2 specular 0.7 roughness 0.05 } } } #declare vv = vv+iv #end //inner loop #declare uu = uu+iu #end //outer loop rotate <-90,0,0> //This is just changing the rotate <0,90,0> //coordinate system. scale 2 } //Lights, camera, action camera { location < 15, 7,-15> direction 1*z look_at < 0, 0, 0> } light_source { <0, 0,-19> color rgb 1 } light_source { <19, 2, 0> color rgb 1 } object {box{-20,20 inverse}pigment{color rgb 0.8}}