#include "colors.inc" #include "metals.inc" #include "functions.inc" #include "transforms.inc" #include "newdefs.ini" #declare cyl_radius=0.07; #declare spr_maj_radius=0.05; #declare spr_min_radius=0.01; #declare Rod= cylinder { <0, 0, 0>, // Center of one end <0, 2, 0>, // Center of other end cyl_radius // Radius texture { T_Chrome_3A // Pre-defined texture scale 4 // Scale by the same ammount in all directions } rotate <0, 0, theta*180/pi> } #declare Spring= isosurface { function { f_helix1(x, y, z, 1, 20*pi, spr_min_radius, spr_maj_radius, 1, 1, 0) } max_gradient 3 contained_by { box{-1/2, 1/2} } texture {T_Brass_3A} scale <1, sqrt(2)*sin(theta), 1> rotate <0, 0, 90> rotate <0, 90, 0> translate <0, 1, 0> rotate <0, 0, acos(cos(theta)/sqrt(1-1/2*pow(sin(theta),2)))*180/pi> } camera { location <0, 2, -3> look_at <0, 1, 0> } object { Rod rotate <0, phi*180/pi, 0> } object { Rod rotate <0, (phi+pi/2)*180/pi, 0> } object { Rod rotate <0, (phi+pi)*180/pi, 0> } object { Rod rotate <0, (phi+3*pi/2)*180/pi, 0> } object { Spring rotate <0, (phi+pi/4)*180/pi, 0> } object { Spring rotate <0, (phi+3*pi/4)*180/pi, 0> } object { Spring rotate <0, (phi+5*pi/4)*180/pi, 0> } object { Spring rotate <0, (phi+7*pi/4)*180/pi, 0> } light_source { <2, 4, -3> color White } light_source { <-2, -4, -3> color White }