// Entry code: eezfer // Name : Gary M Gerken // Frame rate: 25 // Animation created for the 5th Short Code Contest: Three red balls rolling around a // Mobius strip // // This is a pretty simple animation but there's some nostalgic value to it. I tried // to recreate the first "serious" animation I ever did. The SDL for this version took // 468 bytes. The SDL for the original version took... well... let's just say a whole // lot more than 468 bytes. // If I were better at using POV-Ray, I could probably get rid of the global_settings // and / or light_source blocks by fiddling with the object pigments and finishes. global_settings { assumed_gamma 1 } light_source { y color rgb 1 } // This macro takes a vector m in coordinates and moves it around the strip. a = 360 equates to once // around the strip. a = 720 twice around the strip and back to the starting point. // // We could save a byte by defining a macro equal to "vaxis_rotate(" but that makes the // SDL evel less readable! // // The Mobius strip width and radius are hardcoded to look okay when using the default camera. #macro F(m,a) vaxis_rotate(vaxis_rotate(vaxis_rotate(m, z, a/2) + x/3, y, a), x, -30) + y/12 + z*3/4 #end // Build the Mobius strip from five degree "slats". #local a=360; #while(a) // n and o are the unit normals at the two ends of this five degree slat. #local n=F(-x,a); #local o=F(-x,a+5); // p alternates between zero and one as we go from slat to slat. Used to set slat color. #local p=mod(a/5,2); // The slat edges are +/- 1/30*y prior to transformation. Defining q saves a few bytes later. #local q=y/30; // Build each slat from two smoothed triangles. union { smooth_triangle { F(-q,a) n F(-q,a+5) o F(q,a+5) o } smooth_triangle { F(q,a+5) o F(q,a) n F(-q,a) n } pigment { rgb } } #local a=a-5; #end // Macro to add a red ball which "rolls" around the Mobius strip. h is an offset defining // how far around the strip the ball is when clock equals zero. #macro s(h) sphere { F(x/30, h+clock*237.6) .032 pigment { rgb x } finish { phong .5 } } #end // Add three balls evenly spaced around the strip. s(0) s(240) s(480)