#include "colors.inc" #include "metals.inc" #include "finish.inc" #include "golds.inc" #include "math.inc" #include "woods.inc" #include "shapes.inc" #include "textures.inc" #include "stones.inc" global_settings { max_trace_level 15 ambient_light rgb<1, 1, 1> } #declare diskrad = 1.5; #declare diskthickness = .2; #declare dt2 = .5*diskthickness; #declare rodrad = .1; #declare omegay = -360; //once around #declare omegay = 0;//no precession #declare omeganu = 5*360; #declare omeganur = omeganu*pi/180; #declare nuamplitude = 5; //was 5 #declare liftangle = 20+nuamplitude*cos(omeganur*clock); #declare liftar = liftangle*pi/180; #declare hangle = omegay*clock+nuamplitude*sin(omeganur*clock); #declare vrodheight = 2*diskrad; #declare tablesize=3; //table size to set overall scale? //counter weight on gyro that cteates precession #declare mass = union{ difference{ torus{rodrad*1.2, rodrad*.2} Wedge(90) rotate x*90 translate y*rodrad*.2} cylinder{<0,-rodrad*1.0,0>,<0,-2*rodrad,0>, rodrad*.2} cone{<0,0,0>,rodrad*.2,<0,-rodrad,0>,1.5*rodrad translate <0,-2*rodrad>} cylinder{<0,-3*rodrad,0>,<0,-6*rodrad,0>, 1.5*rodrad} } union{ //everything that pivots horizontally union{ //everything that pivots vertically difference{ //the disk cylinder{<0,0,-dt2>,<0,0,dt2>,diskrad } cylinder{<0,0,-dt2*1.1>,<0,0,dt2*1.1>,rodrad } texture { pigment { wood color_map { [0.0 color P_Silver1] [0.5 color P_Silver3] [1.0 color P_Silver5] } turbulence .2 scale <0.5, 0.5, 2> } finish { F_MetalA // roughness .01 } } rotate z*clock*360*2 } cylinder{<0,0,-dt2*1.4>,<0,0,dt2*1.4>,rodrad*1.03 } // black bearing cylinder{<0,0,-dt2*2>,<0,0,dt2*2>,rodrad*4 translate z*2.5*diskrad texture{T_Stone6 scale .1 }} // counterweight bearing cylinder{<-1*diskrad,0,0>,<3*diskrad,0,0>,rodrad //rod 1 texture{Brushed_Aluminum scale .5 } rotate -90*y} //no mass object{mass rotate -liftangle*x translate -diskrad*z } //placed counterweight translate -z*diskrad rotate liftangle*x } //fork difference{ box { <-1.5*rodrad, -3*rodrad, -rodrad>, <1.5*rodrad, rodrad, rodrad> } box { <-1.05*rodrad, -2*rodrad, -1.1*rodrad>, <1.05*rodrad, 1.1*rodrad, 1.1*rodrad> } } //verticle rod cylinder{<0,0,0>,,rodrad //rod 1 texture{Brushed_Aluminum scale .5 } rotate 90*z translate -y*vrodheight} translate y*vrodheight rotate hangle*y } //base union{ cylinder { <0, 0, 0>, <0, .5*diskthickness, 0>, .8*diskrad } cylinder { <0, 0, 0>, <0, 2*diskthickness, 0>, 2.2*rodrad } texture{T_Stone6 scale .1 } } camera { location 6*<0, tablesize ,-6*tablesize> look_at <0, tablesize*.7, 0> angle 4 } //ambient illumination is too dark light_source { <0,+40,-10> color White} /* build the tamble lumber */ #declare leg = cylinder{<0,-tablesize*.75,0>,<0,0,0>,.5} merge{ object{ leg translate (x+z)*tablesize} object{ leg translate (x-z)*tablesize} object{ leg translate -(x+z)*tablesize} object{ leg translate -(x-z)*tablesize} texture{T_Wood32 } } //Table surface box { <-tablesize, -.1, -tablesize>, pigment { hexagon P_Silver5, P_Brass1, P_Gold1 scale .6 } finish{ F_MetalA} } //the sky from doc's standard example sky_sphere { pigment { gradient y color_map { [0.000 0.002 color rgb <1.0, 1, 0.8> color rgb <1.0, 1, 0.8>] [0.002 0.200 color rgb <0.8, 0.8, 0.6> color rgb <0.2, 0.2, 0.8>] } scale 2 translate -1 } rotate -105*x rotate y*90 } plane { //grassy plane y, -.75*tablesize texture { // pigment { color rgbt <.2,.9,.2,.1> } pigment { color rgbt <.6,1,.7,0> } // normal { bumps 0.3 scale .05 } finish { phong 20 ambient .5 diffuse .3} // pigment { color rgbt <.2,.9,.2,.1> } // normal { bumps 0.3 scale 0.05 } // finish { phong 10 } } }