// ** POVRay object: Plastic Phono Plug ** // ** 2002 by Hugo Asmussen. Freeware ** // ** ** // ** 1 unit = 1 centimeter ** // ** ** // ** Advice: Set max_trace_level to 3 ** // ** to speed up rendering of the ** // ** blurred metal. Or remove the blur ** // Textures #local Pigment_White=pigment { average pigment_map { [ .96 spherical color_map { [ 0 rgb 1.35 ] [ 1 rgb 1 ] } scale <2,.19,2> turbulence .5 translate <0,-.825,.4> ] [ .4 bumps color_map { [ 0 rgb .9 ] [ 1 rgb <.12,.5,.36> ] } scale <.2,.5,.2> ] }} #local Pigment_Yellow=pigment { average pigment_map { [ .96 spherical color_map { [ 0 rgb <1.15,1.15,.12> ] [ 1 rgb <.9,.9,.06> ] } scale <2,.19,2> turbulence .5 translate <0,-.825,.4> ] [ .4 bumps color_map { [ 0 rgb .9 ] [ 1 rgb <.12,.5,.36> ] } scale <.2,.5,.2> ] }} #local Pigment_Red=pigment { average pigment_map { [ .96 spherical color_map { [ 0 rgb <1.45,.12,.12> ] [ 1 rgb <1.2,.06,.06> ] } scale <2,.19,2> turbulence .5 translate <0,-.825,.3> ] [ .4 bumps color_map { [ 0 rgb 1 ] [ 1 rgb <.12,.5,.36> ] } scale <.2,.5,.2> ] }} #local Plastic_Finish_Normal=texture { normal { average normal_map { [ .9 facets coords .28 scale .2 ] [ .8 bumps .0255 scale <.07,.8,.07> ] [ 1.1 cylindrical 8 ] } } finish { specular .2 roughness .1 reflection .17 metallic .6 diffuse .5 ambient 0 } } #local White_Plastic=texture { Plastic_Finish_Normal Pigment_White } #local Yellow_Plastic=texture { Plastic_Finish_Normal Pigment_Yellow } #local Red_Plastic=texture { Plastic_Finish_Normal Pigment_Red } #local Metal=texture { average texture_map { #local Count=0; #local Se=seed(0); #while(Count<6) // Blur samples 0 - 255 [1 pigment { rgb 1.1 } finish { reflection .63 specular .13 roughness .06 brilliance 2.1 diffuse .43 ambient 0 } normal { bumps .1 scale .05 turbulence .2 translate *.2 } ] #local Count=Count+1; #end }} // These variables should not be changed... #local L=1/2; // Length of outer cylinder #local R=.51; // Radius of outer cylinder #local RT=.025; // Round Thickness #local RT2=.056; // Rounder Thickness #local I=.45; // Inner cylinder (metal) #local S=6; // Steps around cylinder, like a bolt #local B1=-L-RT; // Box Y position 1 #local B2=B1-.6; // Box Y position 2 (lower) #local Rot=360/S; // Amount to rotate for each step #local BS=.09; // Box XZ size - beyond cylinder #local BX=.5*vrotate((R+BS)*z,Rot).x+RT2/2-.028; // Box X length #local BL=.19; // Box Lower parts (2 parts) #local BC=B2-BL*2-RT*2-.045; // Bottom Cylinder part #local BI=BC-.2; // Bend In #local RBG=BI+RT/2-RT*2-.16; // Right Before Gitter #local GS1=R-(BC-BI)-RT/7; // Gitter Size 1 (start) #local GE=RBG-1.01; // Gitter Position (Final end) #local GA=5; // Gitter amount #local GT=.125; // Gitter Thickness (start) #local GD=.06; // Gitter Distance between steps #local MC=.17; // Metal Cylinder #local MS=.77; // Metal Stick #local Se=seed(0); #declare Phono_Metal=union { difference { union{ difference { cylinder { 0,(L+MC)*y,I } cylinder { 0,(L+MC+.01)*y,I-RT*1.5 } } torus { I-RT*.75,RT*.75 translate (L+MC+.01-RT*.75/2)*y } } cylinder { 0,(L+MC+.025)*y,RT+.002 scale <.8,1,1.2> translate (I-RT*.75-.001)*z rotate -95*y } } cylinder { 0,(L+MS)*y,.1 } sphere { 0,.1 scale <1,.84,1> translate (L+MS)*y } texture { Metal } } #macro Cylinder_Wobble(Start,End,Size,Variance,Steps) #local Count=1/Steps; #local Va1=rand(Se)*Variance; #local Pos1=Start; union { #while (Count<1) #local Va2=rand(Se)*Variance; #local Pos2=(End-Start)*Count+Start; cone { Pos1*y, Va1+Size, Pos2*y, Va2+Size scale <1,1,1-((Va1+Va2)*15)> } #if (Count<1-1/Steps) sphere { 0,Va2+Size scale <.95,2.5,1-((Va1+Va2)*15)> translate Pos2*y } #end #local Va1=Va2; #local Pos1=Pos2; #local Count=Count+(1/Steps); #end // remember to finish with } paranthesis #end #declare Phono_Plug=union { object { Phono_Metal } cylinder { -L*y,L*y,R open } torus { R-RT,RT translate L*y } difference { cylinder { (L-.1)*y, (L+RT)*y,R-RT } cylinder { (L-.11)*y,(L+RT+.01)*y,I } } torus { R+RT,RT clipped_by { cylinder { (-RT)*y,0,R+RT } } translate -L*y } Cylinder_Wobble (-L,L,.02 ,.016,6) translate (RT/2-R+.0017)*z } // Streg Cylinder_Wobble (-L,L,.02 ,.016,6) translate (-RT/2+R-.0017)*z } // Streg #while (S>0) cylinder { (B1-RT)*y,B2*y,RT2 translate (-R-BS+RT2/1.82)*z rotate (Rot*S)*y } sphere { 0,RT2 scale <1,.5,.55> translate <0,B1-RT,-R-BS+RT/2.4> rotate (Rot*S)*y } sphere { 0,RT2 scale <1,.5,.55> translate <0,B2,-R-BS+RT/2.4> rotate (Rot*S)*y } sphere { 0,RT2 scale <1,.5,.55> translate <0,B2-BL,-R-BS+RT/2.4> rotate (Rot*S)*y } sphere { 0,RT2 scale <1,.5,.55> translate <0,B2-BL*2,-R-BS+RT/2.4> rotate (Rot*S)*y } #if (S!=6 & S!=4 & S!=3 & S!=1) cylinder { B2*y,(B2-BL)*y,RT2 translate (-R-BS+RT2/1.06)*z rotate (Rot*S)*y } #end cylinder { (B2-BL)*y,(B2-BL*2)*y,RT2 translate (-R-BS+RT2/1.82)*z rotate (Rot*S)*y } union { cylinder { (RT/2-BX)*y,(BX-RT/2)*y,RT rotate 90*z translate <0,B1-RT,-R-BS/2+RT/4+RT> } box { <-BX,B1-RT,-R-BS/2+RT/4>, } box { <-BX,B1-RT,-R-BS/2+RT>, } cylinder { (RT/2-BX)*y,(BX-RT/2)*y,RT rotate 90*z translate <0,B2,-R-BS/2+RT/4+RT> } box { , } cylinder { (RT/2-BX)*y,(BX-RT/2)*y,RT rotate 90*z translate <0,B2-BL,-R-BS/2+RT/4+RT> } box { <-BX,B2-BL,-R-BS/2+RT/4>, } box { <-BX,B2-BL*2,-R-BS/2+RT>, } cylinder { (RT/2-BX)*y,(BX-RT/2)*y,RT rotate 90*z translate <0,B2-BL*2,-R-BS/2+RT/4+RT> } #if (S=6 | S=3) box { , } cylinder { B2*y,(B2-BL)*y,RT2 translate } cylinder { B2*y,(B2-BL)*y,RT2 translate } #end rotate (Rot*(S+.5))*y } #local S=S-1; #end cylinder { (B2-BL*2-RT*2)*y,BC*y,R open } torus { R-RT,RT translate BC*y } torus { R+RT,RT clipped_by { cylinder { RT*y,0,R+RT } } translate (B2-BL*2-RT*2)*y } difference { cylinder { BC*y,BI*y,R-RT } torus { R,BC-BI scale <1,1.5,1> translate (BI-RT-(BC-BI)*.5)*y } } torus { GS1,RT translate (BI+RT/2)*y } torus { GS1,RT translate (BI+RT/2-RT*2)*y } cylinder { (BI+RT/2-RT*2)*y,(RBG+RT)*y,GS1+RT } torus { GS1,RT translate (RBG+RT)*y } #local Count=0; #local Pos=RBG-GD; #while (Count<1) torus { GS1,RT translate (Pos-RT)*y } cylinder { (Pos-RT)*y, (Pos-GT+RT)*y, GS1+RT open } torus { GS1,RT translate (Pos-GT+RT)*y } #local Count=Count+(1/GA); #local Pos=Pos-GT-GD; #local GT=GT-.0123; #local GS1=GS1-.0125; #end #local Count=0; #while (Count<1) box { <-.04,RBG+.05,GS1+.05>,<.04,Pos,GS1+.13> rotate <2.5,360*Count,0> } #local Count=Count+(1/5); #end torus { GS1,RT translate (Pos-RT)*y } cylinder { (Pos-RT)*y, (GE+RT)*y, GS1+RT open } torus { GS1-RT,RT*2 translate (GE+RT)*y } difference { cylinder { (GE+RT)*y,(GE-RT)*y, GS1-RT } cylinder { (GE+RT+.001)*y,(GE-RT-.001)*y, GS1-RT-.075 } } translate (-GE/2-L/1.67-MS/1.2)*y } // Final object declarations #declare White_Phonoplug=object { Phono_Plug texture { White_Plastic } } #declare Yellow_Phonoplug=object { Phono_Plug texture { Yellow_Plastic } } #declare Red_Phonoplug=object { Phono_Plug texture { Red_Plastic } } // EOF (End Of File)