#declare NumPoints = 96; #declare ConOff = 12; #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.5*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 Pts = array [NumPoints] #declare p = 0; #while (p < NumPoints/8) #declare a = (NumPoints-sqrt(6)*p)/(NumPoints); #declare b = sqrt(1-a*a); #debug str(a, 1, 3) #debug ", " #debug str(b, 1, 3) #debug "\n" #declare Pts[p] = < 0, a, 0>; #declare Pts[p+1] = < 0, -a, 0>; #declare Pts[p+2] = < a, 0, 0>; #declare Pts[p+3] = < -a, 0, 0>; #declare Pts[p+4] = < b, 0, 0>; #declare Pts[p+5] = < -b, 0, 0>; #declare Pts[p+6] = < 0, b, 0>; #declare Pts[p+7] = < 0, -b 0>; #declare i=0; #while (i<4) sphere{Pts[p+i] RadS texture{TexS} finish{FinS} } sphere{Pts[p+i+4] RadS texture{TexS} finish{FinS} } #declare j=0; #while (j<4) cylinder{Pts[p+i] Pts[p+4+j] + 0.000000001*x RadC texture{TexC} finish{FinC} } #declare j=j+1; #end #declare i=i+1; #end #declare p = p+1; #end #declare p = 0; #while (p < NumPoints) //#debug str(mod(p+NumPoints/2+p*ConOff, NumPoints), 0, 1) //#debug "\n" //cylinder{Pts[p] Pts[p+NumPoints] + 0.000000001*x RadC texture{TexC} finish{FinC} } //cylinder{Pts[p] Pts[2*NumPoints-1-p] + 0.000000001*x RadC texture{TexC} finish{FinC} } #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 } } 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