#declare tagger_red = <.8, .1, .1>; #declare tagger_green = <.1,.8,.1>; #declare camera_location = <0,0,-10>; #declare light_location = camera_location + <0,10,-20>; camera { location camera_location look_at <0,0,0> } light_source { light_location color <1,1,1> } plane { y, -1 pigment { checker color tagger_red color tagger_green } } //creates a spring resting at y=0 and centered around the y axis. #macro makeSpring (coilradius,wireradius,threadangle,coilheight) #local torushalf = torus { coilradius, wireradius clipped_by { plane {x 0} } } union { #local torusTranslation = coilradius*sin(radians(threadangle)); #local currentTorus = 0; #while (2*currentTorus* torusTranslation < coilheight) object { torushalf #local theSign = pow(-1,currentTorus); scale rotate <-theSign*threadangle,0,0> translate <0,2*currentTorus* torusTranslation,0> } #local currentTorus = currentTorus + 1; #end } #end object { makeSpring(1,.1,8,5) translate <0,-2.5,0> rotate <0,0,90> translate camera_location+<0,0,6> pigment { color rgb <0,1,0> } }