#declare NumPoints = 120; #declare ConOff = -3; #declare PI = 3.14159265; #include "colors.inc" #include "woods.inc" #include "metals.inc" // The values below may be changed (original values in brackets): // Stereo type may be 0 (mono) or 1 (single image stereo) // or 2 (double image file stereo). If 2 then you must use a // povray option like +KFF2 which will produce the left and right // stereo views in separate image files. #declare StereoType =0; // Distance of points centre from viewer (3.26822010762) #declare Distance = 2.5; #if (StereoType=1 | StereoType=3) #declare Distance = Distance*1.6; #end // Width of perspective (2) #declare PerspFactor = 2; // View point, where camera looks (<0.0002411332445, -0.0024590813305, -0.00689596887395>) #declare ViewPt = <0, 0, 0>; // Rotation about points centre (<0, 0, 0>) #declare Rotation = <0, 0, 0>; // The following values may be 0 (don't show element type) or 1 (show it) #declare ShowSpheres = 1; #declare ShowEdges = 1; #declare ShowVertexNums = 0; // Radius, Texture and Finish for Sphere Points #declare RadS = PI/(2*NumPoints); #declare TexS = texture {pigment {P_Silver3 }} #declare FinS = finish {ambient 0.3 diffuse 0.4} // Radius, Texture and Finish for Connecting Cylinders #declare RadC = RadS/3; #declare TexC = texture {pigment {color MediumGoldenrod }} #declare FinC = finish {ambient 0.3 diffuse 0.4} // Shadow, 0 - shadows mono no shadows stero, 1 - no shadows, 2 - shadows #declare Shadow = 0; background {color White} // ########### End of configurable values ############ // Stereo offset (offset of images or camera from mono position) #declare StereoOffset = Distance/3.5; #declare CamLocOff = <0, 0, -Distance*PerspFactor>; #if (StereoType=2) // Stereo using separate image file for each view #if (clock=0) #declare CamLocOff = CamLocOff + < StereoOffset, 0, 0>; #else #declare CamLocOff = CamLocOff + <-StereoOffset, 0, 0>; #end #end #if (StereoType=3) // Four views, so move the camera back a bit more #declare CamLocOff = CamLocOff*1.2; #end camera { location ViewPt + CamLocOff look_at ViewPt direction <0 , 0, PerspFactor> right <1, 0, 0> } // Points Centre and Maximum distace from centre to the edge of a sphere #declare PtsCentre = <0, 0, 0>; #declare MaxDist = 2; light_source {ViewPt + <0, 0, -MaxDist*10> color White #if (Shadow=1|(!Shadow & StereoType)) shadowless #end } light_source {ViewPt + <0 ,5*MaxDist, -MaxDist*10> color White #if (Shadow=1|(!Shadow & StereoType)) shadowless #end } #declare Cluster = union { #declare Rad=(ConOff+2)/ConOff; #declare Pts = array [NumPoints] #declare p = 0; #while (p < NumPoints) #declare Pts[p] = < Rad*cos(2*PI*p/NumPoints), Rad*sin(2*PI*p/NumPoints), 0>; sphere{Pts[p] RadS texture{TexS} finish{FinS} } #declare p = p+1; #end #declare p = 0; #while (p < NumPoints) //#debug str(mod(p+NumPoints/2+p*ConOff, NumPoints), 0, 1) //#debug "\n" #declare p1 = Pts[p]; #declare p2 = Pts[mod(mod(p+NumPoints/2+p*ConOff, NumPoints)+NumPoints, NumPoints)]; #declare pos = (p2+p1)/2; #if ( (p1.x!=p2.x) | (p1.y!=p2.y) ) #declare vec = vnormalize(p2-p1); #else #declare vec = vnormalize(<-p1.y, p1.x, 0>); #end #declare vec = sqrt(1 - vdot(pos, pos))*vec; cylinder{pos+vec pos-vec RadC texture{TexC} finish{FinC} } sphere{pos+vec RadS texture{TexS} finish{FinS} } sphere{pos-vec RadS texture{TexS} finish{FinS} } #declare p = p+1; #end } #declare TextSize = RadS; #declare FontFile = "cyrvetic.ttf" #if (StereoType=0|StereoType=2) // Mono, or Stereo using two image files #declare ArrSize = 1; #declare Offsets = array[ArrSize] {<0, 0, 0>} #end #if (StereoType=1) // Single Image Stereo #declare ArrSize = 2; #declare Offsets = array[ArrSize] {<+StereoOffset, 0, 0>, <-StereoOffset, 0, 0>} #end #if (StereoType=3) // Tetra View #declare ArrSize = 4; #declare Offsets = array[ArrSize] {<-StereoOffset, +StereoOffset, 0>, <+StereoOffset, +StereoOffset, 0>, <+StereoOffset, -StereoOffset, 0>, <-StereoOffset, -StereoOffset, 0>} #declare OrigRot = Rotation; #declare Rots = array [ArrSize] {<0, 0, 0>, <0, 135, 30>, <0, -135, -30>, <135, 0, 180>} #end #declare Off=0; #while(Off <1.2,1.2,0.2> texture{ T_Wood2 } } //torus { 1 RadS texture{ TexS } rotate <90,0,0>} object { Cluster translate - PtsCentre rotate Rotation translate PtsCentre + Offsets[Off] } #if (ShowVertexNums) #declare Pt=0; #while (Pt translate vrotate((Pts[Pt] - PtsCentre)*(1+RadS*1.8/vlength(Pts[Pt]-PtsCentre)), Rotation) - translate PtsCentre + Offsets[Off] } #declare Pt = Pt+1; #end #end // Don't do slow clipping unless there is chance of overlap #if ((StereoType=1|StereoType=4) & ((Distance < MaxDist*1.6*2.49) | (vlength(ViewPt-PtsCentre))) ) bounded_by { box { MaxDist*(<1, 1, 1>), -MaxDist*<1, 1, 1> translate MaxDist* translate Distance*PerspFactor*z rotate <-3*atan(Offsets[Off].y/(Distance*PerspFactor)), 3*atan(Offsets[Off].x/(Distance*PerspFactor)),0> translate -Distance*PerspFactor*z+ViewPt } } clipped_by { bounded_by } #end } #declare Off = Off+1; #end