(c9)
dispfun(zigzag,drifter,zrp,zr1d,zr1da)$
(e9) zigzag(x) := (mode_declare(x, float), 0.5 - ( - 1)^(floor(x)) * (nummod(x, 1) - 0.5))
(e10) drifter(x, y, z) := ([zigzag(0.75 + z * 1.0e+20), zigzag(0.5 +
1.99998e+20 * z), zigzag(2.99999e+20 * z)],
endcons('rgb, ((%%)/(1 + %% . ((%%)/3)))))
(e11) zrp(n) := block([color_function : 'drifter, color_normalize : false], zr1d(n, 0))
(e12) zr1d(n, z) := block([faces : zr1da(n), equalscale : true, ct :
0.0d0, inc : dfloat(3.0^( - 1) * 1.0e-20), l],
l : length(faces), for j thru l do (if 3 * j = l + 3 OR 3 * j = 2 * l + 3
then ct : ct + inc else false,
for i thru length(faces[j]) do (faces[j])[i]
: endcons(ct + z, rectformlist((faces[j])[i]))),
plotfaces(faces))
(e13) zr1da(n) := if n = 0 then [[0, 1, 0.86603 * %i + 0.5]] else
(zr1da(n - 1), expand(append(%% * (0.5 - 0.28867 * %i),
reverse(%%) * (0.28868 * %i - 0.5) + 1.0,
%% * (0.57735 * %i - 1.8124e-7) + 1.0)))
(c8)
block([plot_style:dragstyle],zrp(8))$