/* povray Width=640 Height=480 Clock=0.0 Display=off Verbose=off Output_File_Name=smartwheel-0.0.png +A +FN8 smartwheel.pov povray Width=640 Height=480 Clock=0.5 Display=off Verbose=off Output_File_Name=smartwheel-0.5.png +A +FN8 smartwheel.pov povray Width=640 Height=480 Clock=1.0 Display=off Verbose=off Output_File_Name=smartwheel-1.0.png +A +FN8 smartwheel.pov povray Width=320 Height=240 Final_Frame=160 Display=off Verbose=off +FN8 smartwheel.pov */ #include "colors.inc" #include "golds.inc" #include "metals.inc" #macro Interp(A, B, T) A + (B - A) * T #end #macro InterpClamp(A, B, T) Interp(A, B, min(1, max(0, T))) #end #declare SolidR = 1; #declare BaseLength = 0.5; #declare MaxLength = 1; #declare FootWidthHalf = 0.1; #declare FootThickness = 0.025; #declare Segments = 5; #declare SegmentLength = MaxLength / Segments; #declare MinLength = SegmentLength + FootThickness * Segments; #declare LegRange = MaxLength - MinLength; #declare MaxShaft = 0.05; #declare MinShaft = 0.005; #declare ShaftStep = (MinShaft - MaxShaft) / Segments; #declare GroundA = 0; #declare GroundB = 0.3; #declare Above = (SolidR + MinLength + LegRange * 0.2); #declare WheelX = (clock - 0.5) * 4; #declare WheelOrigin = < WheelX, InterpClamp(Above+GroundA, Above+GroundB, clock * 2) 0 >; camera { location <(WheelOrigin.x - 0.7) * 0.5, WheelOrigin.y - SolidR, -3.5> angle InterpClamp(60, 16, clock * 8 - 7) look_at WheelOrigin + InterpClamp(0, <0, -(SolidR + MinLength)>, clock * 2) } light_source { <-10, 10, -10> color White } light_source { <10, 10, -5> color White } sky_sphere { pigment { gradient y color_map { [0.0 color rgb <0.7,0.7,1.0>] [1.0 color blue 0.5] } } } union { plane { y, GroundA } difference { plane { y, GroundB } plane { x, 0 } } texture { pigment { checker color <0,.5,0> color <0,.6,0> //scale 0.15 } finish {reflection 0.2} } } #declare Plastic = texture { pigment { color rgb .5 } } //pigment { color rgb <0.5, 0.23, 0.2> } #macro SmartLeg(legBase, legTip, footDir) union { #local legDelta = legTip - legBase; #local dir = vnormalize(legDelta); #local legLength = vlength(legDelta); #local tooLong = (legLength > (MaxLength + 0.001)); #local tooShort = (legLength < (MinLength - 0.001)); #local baseBall = MaxShaft * 1.45; #local baseBallClamp = MaxShaft * 1.9; // base sphere { <0, 0, 0>, baseBall texture { T_Silver_3E } } cylinder { <0, 0, baseBallClamp>, <0, 0, -baseBallClamp>, baseBall * 0.35 texture { Plastic } } // tip union { sphere { 0, 1 scale translate FootThickness / 2 * y #if (tooLong | tooShort) pigment { color Yellow } #else texture { Plastic } #end } cylinder { <0, 0, FootThickness * 2>, <0, 0, -FootThickness * 2>, FootThickness * 1.034 * 0.35 texture { Plastic } } sphere { 0, FootThickness texture { T_Silver_3E } } #local my = vnormalize(footDir); #local mx = vcross(my, z); #local mz = vcross(mx, my); matrix < mx.x, mx.y, mx.z, my.x, my.y, my.z, mz.x, mz.y, mz.z, 0, 0, 0 > translate legDelta } #if (!tooShort) #local legSegment = 0; #while (legSegment < Segments) cylinder { <0, 0, 0>, dir * (SegmentLength + ShaftStep), MaxShaft + legSegment * ShaftStep #local extend = (legLength - SegmentLength) / (Segments - 1); translate dir * (legSegment * extend) #if (legSegment = 0) texture { Plastic } #else texture { T_Silver_3A } #end } torus { MaxShaft + (legSegment + 1) * ShaftStep, abs(ShaftStep) texture { Plastic } #local my = vnormalize(dir); #local mx = vcross(my, z); #local mz = vcross(mx, my); matrix < mx.x, mx.y, mx.z, my.x, my.y, my.z, mz.x, mz.y, mz.z, 0, 0, 0 > translate dir * (SegmentLength + legSegment * extend + ShaftStep) } #local legSegment = legSegment + 1; #end #end translate legBase } #end #declare Increment = 10; union { difference { cylinder { <0, 0, FootWidthHalf>, <0, 0, -FootWidthHalf>, SolidR } cylinder { <0, 0, FootWidthHalf * 2>, <0, 0, -FootWidthHalf * 2>, SolidR / 2 } //texture {T_Silver_5A } texture { Plastic } translate WheelOrigin } #declare Legs = 36; #declare IncAngle = 360 / Legs; #declare IncDistance = 0.2; #declare leg = floor(WheelOrigin.x / IncDistance - Legs / 2); #declare nleg = 0; #while (nleg < Legs) #declare leg = leg + 1; #declare nleg = nleg + 1; #local legAngle = (leg - WheelOrigin.x / IncDistance) * IncAngle; #local outward = ; #local base = WheelOrigin + outward * SolidR; #local groundX = leg * IncDistance; #local groundY = ((groundX > (0 - FootWidthHalf)) ? GroundB : GroundA); #local groundSpot = ; #local restSpot = WheelOrigin + outward * (SolidR + MinLength); #local stretch = max(0, min(1, (vlength(groundSpot - base) - MinLength - 0.6) * 0.9)); #local targ = Interp(groundSpot, restSpot, stretch); //#local targ = groundSpot; SmartLeg(base, targ, Interp(-y, targ - WheelOrigin, stretch)) #if (0) text { ttf "cyrvetic.ttf" str(leg, 0, 0) 0, 0 pigment { color rgb 2 } scale 0.2 translate base + z * -1 no_shadow } #end #end }