// // Macros to generate "grown" objects. // Growing an object expands the object by G along its normal. // // Available objects are GrowSphere, GrowBox, GrowTorus, // GrowCylinder, and GrowCone. Parameters are the same as for // the standard object, with the addition of the G parameter. // // (c)2001 Michael D Johnson (aka Redbeard) // redbeard@wv.adelphia.net // // Free use for generating images is hearby granted. Please // do not sell, distribute, or modify without my permission. // #macro GrowSphere(P, R, G) sphere { P, R + G } #end // Assume P1 < P2 #macro GrowBox(P1, P2, G) box { P1 - G, P2 + G } #end #macro GrowTorus(R1, R2, G) torus { R1, R2 + G } #end #macro GrowCylinder(P1, P2, R, G) #local V = vnormalize(P2 - P1); cylinder { P1 - V * G, P2 + V * G, R + G } #end #macro GrowCone(P1, R1, P2, R2, G) #local H = VDist(P1, P2); #local B = R1 - R2; #local V = vnormalize(P2 - P1); #local N = G * B / H; #local M = vlength(); #local X1 = M + N; #local X2 = M - N; cone { P1 - V * G, R1 + X1, P2 + V * G, R2 + X2 } #end