| 1 |
\documentclass{article} |
| 2 |
\usepackage[pdftex,a3paper,margin=1pt,landscape]{geometry} |
| 3 |
\newcount\mlength |
| 4 |
\newcount\cstate |
| 5 |
\newdimen\mandelunit |
| 6 |
\mandelunit=0.5pt |
| 7 |
|
| 8 |
\def\w{% |
| 9 |
\ifnum\cstate=1 \global\advance\mlength1 |
| 10 |
\else \vrule width \mlength\mandelunit height \mandelunit depth 0pt \global\mlength1 \fi |
| 11 |
\global\cstate1} |
| 12 |
\def\b{% |
| 13 |
\ifnum\cstate=-1 \global\advance\mlength1 |
| 14 |
\else \hspace*{\mlength\mandelunit}\global\mlength1 \fi |
| 15 |
\global\cstate-1} |
| 16 |
\def\r{% |
| 17 |
\ifnum\cstate=1\hspace*{\mlength\mandelunit}\else\vrule width \mlength\mandelunit height \mandelunit depth 0pt \fi |
| 18 |
\global\cstate0 \global\mlength0} |
| 19 |
|
| 20 |
\usepackage{lisp-on-tex} |
| 21 |
\usepackage{lisp-mod-fpnum} |
| 22 |
\lispinterp{% |
| 23 |
(\define \maxloop :20) |
| 24 |
(\define \scale +{fpnum::0.002}) |
| 25 |
(\define \isMandell |
| 26 |
(\lambda (\a \b \k \x \y) |
| 27 |
(\lispif (\< \maxloop \k) /t |
| 28 |
(\lispif (\fplt +{fpnum::4.0} (\fpplus (\fpmul \x \x) (\fpmul \y \y))) |
| 29 |
/f |
| 30 |
(\isMandell \a \b (\+ \k :1) |
| 31 |
(\fpplus \a (\fpmul \x \x) (\fpminus (\fpmul \y \y))) |
| 32 |
(\fpplus \b (\fpmul +{fpnum::2.0} \x \y))))))) |
| 33 |
(\define \drawMandell (\lambda (\a \b) |
| 34 |
(\begin |
| 35 |
(\lispif (\isMandell \a \b :0 +{fpnum::0} +{fpnum::0}) |
| 36 |
(\texprint '\b') (\texprint '\w')) |
| 37 |
(\immediatewrite)))) |
| 38 |
(\define \loopMandell (\lambda (\a \b) |
| 39 |
(\lispif (\fplt \b +{fpnum::-1.0}) () |
| 40 |
(\begin |
| 41 |
(\drawMandell \a \b) |
| 42 |
(\lispif (\fplt +{fpnum::0.5} \a) |
| 43 |
(\begin |
| 44 |
(\texprint '\r\\') |
| 45 |
(\immediatewrite) |
| 46 |
(\loopMandell +{fpnum::-1.5} (\fpminus \b \scale))) |
| 47 |
(\loopMandell (\fpplus \a \scale) \b)))))) |
| 48 |
} |
| 49 |
|
| 50 |
\begin{document} |
| 51 |
\thispagestyle{empty} |
| 52 |
\noindent |
| 53 |
\leavevmode\baselineskip=\mandelunit |
| 54 |
\lispinterp{(\loopMandell +{fpnum::-1.5} +{fpnum::1.0})} |
| 55 |
\end{document} |