diff options
Diffstat (limited to 'Master/texmf-dist/doc/latex/lisp-on-tex/examples/fpnummodule-mandelbrot.tex')
-rw-r--r-- | Master/texmf-dist/doc/latex/lisp-on-tex/examples/fpnummodule-mandelbrot.tex | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/latex/lisp-on-tex/examples/fpnummodule-mandelbrot.tex b/Master/texmf-dist/doc/latex/lisp-on-tex/examples/fpnummodule-mandelbrot.tex new file mode 100644 index 00000000000..f0cf68798b5 --- /dev/null +++ b/Master/texmf-dist/doc/latex/lisp-on-tex/examples/fpnummodule-mandelbrot.tex @@ -0,0 +1,55 @@ +\documentclass{article} +\usepackage[pdftex,a3paper,margin=1pt,landscape]{geometry} +\newcount\mlength +\newcount\cstate +\newdimen\mandelunit +\mandelunit=0.5pt + +\def\w{% + \ifnum\cstate=1 \global\advance\mlength1 + \else \vrule width \mlength\mandelunit height \mandelunit depth 0pt \global\mlength1 \fi + \global\cstate1} +\def\b{% + \ifnum\cstate=-1 \global\advance\mlength1 + \else \hspace*{\mlength\mandelunit}\global\mlength1 \fi + \global\cstate-1} +\def\r{% + \ifnum\cstate=1\hspace*{\mlength\mandelunit}\else\vrule width \mlength\mandelunit height \mandelunit depth 0pt \fi + \global\cstate0 \global\mlength0} + +\usepackage{lisp-on-tex} +\usepackage{lisp-mod-fpnum} +\lispinterp{% + (\define \maxloop :20) + (\define \scale +{fpnum::0.002}) + (\define \isMandell + (\lambda (\a \b \k \x \y) + (\lispif (\< \maxloop \k) /t + (\lispif (\fplt +{fpnum::4.0} (\fpplus (\fpmul \x \x) (\fpmul \y \y))) + /f + (\isMandell \a \b (\+ \k :1) + (\fpplus \a (\fpmul \x \x) (\fpminus (\fpmul \y \y))) + (\fpplus \b (\fpmul +{fpnum::2.0} \x \y))))))) + (\define \drawMandell (\lambda (\a \b) + (\begin + (\lispif (\isMandell \a \b :0 +{fpnum::0} +{fpnum::0}) + (\texprint '\b') (\texprint '\w')) + (\immediatewrite)))) + (\define \loopMandell (\lambda (\a \b) + (\lispif (\fplt \b +{fpnum::-1.0}) () + (\begin + (\drawMandell \a \b) + (\lispif (\fplt +{fpnum::0.5} \a) + (\begin + (\texprint '\r\\') + (\immediatewrite) + (\loopMandell +{fpnum::-1.5} (\fpminus \b \scale))) + (\loopMandell (\fpplus \a \scale) \b)))))) +} + +\begin{document} + \thispagestyle{empty} + \noindent + \leavevmode\baselineskip=\mandelunit + \lispinterp{(\loopMandell +{fpnum::-1.5} +{fpnum::1.0})} +\end{document}
\ No newline at end of file |