;ELC   
;;; compiled by yandros@lola-granola.MIT.EDU on Thu Mar  9 18:22:23 1995
;;; from file /afs/sipb/contrib/emacs/elisp19/mandel.el
;;; emacs version 19.28.2.
;;; bytecomp version FSF 2.10
;;; optimization is on.
;;; this file uses opcodes which do not exist in Emacs 18.

(if (and (boundp 'emacs-version)
	 (or (and (boundp 'epoch::version) epoch::version)
	     (string-lessp emacs-version "19")))
    (error "`/afs/sipb/contrib/emacs/elisp19/mandel.el' was compiled for Emacs 19"))

(byte-code "ÀÁ!ˆÀÂ!‡" [require float faces] 2)
(defvar mand-max-iterations 200 "\
*Maximum length of sequence to test for divergence.
If a point's sequence does not diverge after this many elements, we
guess that the point is in the Mandelbrot set.")
(byte-code "ÀÁ!„ ÂÀ‡" [boundp mand-member-color "black"] 2)
(defvar mand-num-fleeing-colors 10 "\
*The number of different colors to use to display fleeing points.")
(defvar mand-char-aspect-ratio 1.8 "\
*The ratio of the visual height of a character cell to its width.
It's not important that this be terribly accurate, since it is only
used to correct the display; if it is wrong, your Mandelbrot set display
will be stretched along one axis.
This is usually a floating point number.")
(defvar mand-fleeing-color-function nil "\
*A function to call to compute colors for fleeing faces, or nil.
If it's a function, it should take one argument, a number between 0
and 1, and return a color name.
If it's nil, the Mandelbrot code will choose a function suitable for
your display when executed.")
(defalias 'not-mand-member-p #[(c) "À	@!À	A!\nÆÆWƒ@ \f‰_‰_\\ÉXƒ@ \f‰\\_\\\f‰_‰_[\n\\\\T‰‚ W…J -‡" [float c cr ci zr zi 0 iter mand-max-iterations 4] 5 "\
Return nil if C is in the Mandelbrot set, non-nil otherwise.
C has the form (REAL . IMAGINARY), representing a complex number.
If C is not in the mandelbrot set, the return value is the number of
iterations it took for the point to escape the circle of radius 2
centered at the origin (points outside this circle always diverge)."])
(defvar mand-fleeing-faces nil "\
A vector of faces to use for fleeing points.
These faces have their background and foreground set to the same
color, so they obscure any characters they are applied to.  This is
deliberate - we store information about which points diverged and
which didn't in the buffer text.")
(defvar mand-last-fleeing-color-function nil "\
The function we used the last time we built mand-fleeing-faces.")
(defalias 'mand-build-faces #[nil "À	!ƒ 	G\nUƒ \f=„z Å\nÆ\"ÇÇ\nWƒw ÉÊË\"!Ì!\n¥!	IˆÏ!ˆÆÓÔÕ%ˆ+ÆÓÖ×%ˆ-T‰‚ )ÏØ!ˆØÙÆÓÔÕ%+‡" [vectorp mand-fleeing-faces mand-num-fleeing-colors mand-fleeing-color-function mand-last-fleeing-color-function make-vector nil 0 i intern format "mand-face-%d" float face-color face-sym make-face frame color face internal-set-face-1 background 5 foreground 4 mand-member "black"] 7 "\
Set up `mand-fleeing-faces', if it isn't already initialized.
If `mand-num-fleeing-colors' or `mand-fleeing-color-function' has
changed since we last built the face array, rebuild it."])
(defalias 'mand-choose-color-scale #[(window) "Á=ƒ ÂÃ\f!!ÅWƒ ÆÇ!‡È ƒ É‡Ê‡ÆË!‡" [window-system x x-display-color-cells window-frame window 16 error "display doesn't have enough colormap entries" x-display-color-p mand-sin-scale mand-gray-scale "mandelbrot requires a window system to display properly"] 3 "\
Return a color scale function appropriate for display in WINDOW."])
(defalias 'mand-gray-scale #[(ratio) "ÀÁ\n‰‰$‡" [format "RGBi:%f/%f/%f" ratio] 5 "\
Return the color whose white/black ratio is RATIO."])
(defalias (quote mand-sin-scale) #[(ratio) "	_ÃÄÅÆÇ\n‰	È_É¥\\\n	‰\\É¥\\E\"#)‡" [ratio pi angle apply format "RGBi:%f/%f/%f" mapcar #[(angle) "À	!Â\\Ã¥‰‰_)‡" [sin angle 1 2 s] 3] 4 3] 10])
(defvar mand-requested-bounds nil "\
Internal variable used by mand-mode.  Buffer-local.

This holds the region of the Mandelbrot set that should be displayed
in the current buffer, stored as a pair of complex numbers.  We
calculate our display scale so that this area fits in the current
window.

Note that, if the window doesn't have the same aspect ratio as this
rectangle, we may display extra area outside this rectangle.

See also mand-plotting-bounds.")
(defvar mand-plotting-bounds nil "\
Internal variable used by mand-mode.  Buffer-local.

This holds the region of the Mandelbrot set that we last plotted in
this window, stored as a pair of complex numbers.  This completely
contains mand-requested-bounds, and is usually larger, because we
try to preserve the aspect ratio of mand-requested-bounds.

See also mand-requested-bounds.")
(defvar mand-character-rectangle-size nil "\
Internal variable used by mand-mode.  Buffer-local.
The number of columns and lines in the mandelbrot plot - a pair of
the form (COLUMNS . LINES).")
(defalias 'mand-canonify-rectangle #[(rect) "@A‰@	@^\nA	A^B\n@	@]\nA	A]*BB‡" [rect c2 c1] 5 "\
Re-arrange RECT so that the car is northwest of the cdr.
This returns a new rectangle (a pair of complex numbers), with the
coordinates rearranged so that both coordinates of the car are less
than or equal to the corresponding coordinates of the cdr."])
(defalias 'mand-rect-width #[(rect) "A@@@Z‡" [rect] 2 "\
Return the width of rectangle RECT.
RECT must be in canonical form."])
(put (quote mand-rect-width) (quote byte-optimizer) (quote byte-compile-inline-expand))
(defalias 'mand-rect-height #[(rect) "AA@AZ‡" [rect] 2 "\
Return the height of rectangle RECT.
RECT must be in canonical form."])
(put (quote mand-rect-height) (quote byte-optimizer) (quote byte-compile-inline-expand))
(defalias 'mand-choose-plotting-bounds #[(columns lines) "À	!\nÃUƒ ÄÅ!ˆ\n_	Ê		‰A@@@Z)_!¥‰\f	‰AA@AZ)Vƒn \f	‰AA@AZ)ZÍ¥	@@	@AZB	A@	AA\\BB‰)‚¯ Ê	‰AA@AZ)_!	¥‰	‰AA@AZ)ZÍ¥	@@Z	@AB	A@\\	AABB‰*+‡" [mand-canonify-rectangle mand-requested-bounds mand-char-aspect-ratio 0 error "mand-char-aspect-ratio should not be zero" columns width lines height float rect height-if-widths-match 2 slack mand-plotting-bounds width-if-heights-match] 5 "\
Set mand-plotting-bounds to fit mand-requested-bounds in COLUMNS x LINES.
This function chooses a value for mand-plotting-bounds that is as small
as possible while completely enclosing mand-requested-bounds and
having the same aspect ratio as COLUMNS x LINES."])
(defalias 'mand-col-row-to-complex #[(column row) "@@Á\n‰A@@@Z)_!\f@¥\\@AÁ‰AA@AZ)_!\fA¥\\B‡" [mand-plotting-bounds float column rect mand-character-rectangle-size row] 7 "\
Return the complex point corresponding to the character position COL, ROW."])
(defvar mand-overlay-list nil "\
Internal variable used by mand-mode.  Buffer-local.
This is a list of the overlays we've created in this buffer, so we
can delete them when we start a new plot.")
(defalias 'mand-insert-display #[(rect width height) "À ˆ	@	AÄÆÇ@A\n@\nA%)È!ˆ\n@@Z\nAAZBÉ‰‰‰\n\fÎÎWƒÂ \n„Â Î\f`ÐÑ\"ˆ\fWƒ° ÓÔ\f\n@_!¥@\\Ô\nA_!¥A\\B!Ö\f\\\f×\\\\\"‰BÚÛƒ£ G¦H‚¤ Ý#ˆ*\fT‰\f‚S ÞÎ!?\nßcˆT‰‚: Èà\nƒÏ á‚Ð â#.‡" [mand-build-faces rect c2 c1 "%.2g" float-output-format format "Plotting %f+%fi to %f+%fi..." message nil input-available start rx ix 0 height insert-char 32 width not-mand-member-p float not-in-set make-overlay 1 o mand-overlay-list overlay-put face mand-fleeing-faces mand-member sit-for 10 "%s %s" "Interrupted." "Done."] 7 "\
Insert a plot of the mandelbrot set in RECT, WIDTH x HEIGHT in size.
The plot is rectangle of text WIDTH characters wide and HEIGHT lines high.
RECT should be a rectangle, in canonical form."])
(defalias 'mandelbrot #[nil "ÀÁ!‰qˆÃ ˆÄ\n!ˆÅÇÈ !SÉÈ !SB\nË )‡" [get-buffer-create "*Mandelbrot Set*" buffer mand-mode switch-to-buffer ((-2 . -2) 2 . 2) mand-requested-bounds window-width selected-window window-height mand-character-rectangle-size mand-refresh] 4 "\
Plot the mandelbrot set in the current window.
This uses spaces for pixels, so the resolution usually isn't very
high, unless you're using a very small font." nil])
(defalias 'mand-refresh #[nil "ÀÁ!ˆÂp!‰ƒ Ä!SÅ!SBÇ@A\"ˆ„* É!Ê ˆËÌ\"ˆÎÏ@A#ˆebˆ…L Ñ`\")‡" [message "Plotting (getting ready)..." get-buffer-window window window-width window-height mand-character-rectangle-size mand-choose-plotting-bounds mand-fleeing-color-function mand-choose-color-scale erase-buffer mapcar delete-overlay mand-overlay-list nil mand-insert-display mand-plotting-bounds set-window-start] 5 "\
Plot the mandelbrot set in the current buffer.
Choose the scale such that the area specified in mand-requested-bounds
is as large as possible, but fits within the buffer's window." nil])
(defalias 'mand-zoom-in #[(event) "À ˆŠ	‰A@)‰A@:ƒ \nA@@‚ \nA@)bˆÃiÄyˆÅe`\"\"Æ‰A@@@Z)!É¥Æ‰AA@AZ)!É¥\n‰\f@Z\fA\nZB\f@\\\fA\n\\BBÍ ,‡" [read-event event position mand-col-row-to-complex 0 count-lines float mand-requested-bounds rect 4 half-new-height half-new-width new-center mand-refresh] 6 "\
Magnify the area around the mouse click by a factor of two." "e"])
(defalias 'mand-zoom-out #[(event) "À ˆŠ	‰A@)‰A@:ƒ \nA@@‚ \nA@)bˆÃiÄyˆÅe`\"\"‰A@@@Z)‰AA@AZ)	‰\n@	Z\nAZB\n@	\\\nA\\BBË ,‡" [read-event event position mand-col-row-to-complex 0 count-lines mand-requested-bounds rect half-new-height half-new-width new-center mand-refresh] 6 "\
Unzoom, showing four times the area current displayed, centered at the click." "e"])
(defalias 'mand-circle-radius-two #[nil "ÀÂ ‡" [((-2 . -2) 2 . 2) mand-requested-bounds mand-refresh] 1 "\
Change scale so that the whole Mandelbrot set just fits in the window." nil])
(defalias 'mand-move-subr #[(delta) "@	‰A@\n@@Z)_A	‰AA\n@AZ)_B	@@@\\	@AA\\B	A@@\\	AAA\\BBÄ )‡" [delta mand-requested-bounds rect scaled-delta mand-refresh] 5 "\
Move the viewing area in the direction specified by DELTA, a complex."])
(defalias 'mand-move-up #[(prefix) "ÀÁ\n[B!‡" [mand-move-subr 0 prefix] 3 "\
Shift the viewing area up the plane (towards negative imaginary infinity)." "p"])
(defalias 'mand-move-down #[(prefix) "ÀÁ\nB!‡" [mand-move-subr 0 prefix] 3 "\
Shift the viewing area down the plane (towards positive imaginary infinity)." "p"])
(defalias 'mand-move-left #[(prefix) "À	[ÂB!‡" [mand-move-subr prefix 0] 3 "\
Shift the viewing area left on the plane (towards negative real infinity)." "p"])
(defalias 'mand-move-right #[(prefix) "À	ÂB!‡" [mand-move-subr prefix 0] 3 "\
Shift the viewing area right on the plane (towards positive real infinity)." "p"])
(defvar mand-mode-map (byte-code "À Â	ÃÄ#ˆÂ	ÅÆ#ˆÂ	ÇÈ#ˆÂ	ÉÈ#ˆÂ	ÊË#ˆÂ	ÌÍ#ˆÂ	ÎÏ#ˆÂ	ÐÑ#ˆÂ	ÒÓ#ˆ	)‡" [make-sparse-keymap mand-mode-map define-key [down-mouse-1] mand-zoom-in [down-mouse-2] mand-zoom-out " " mand-refresh "" "t" mand-circle-radius-two [up] mand-move-up [down] mand-move-down [left] mand-move-left [right] mand-move-right] 4) "\
Keymap used for mand-mode, the Mandelbrot set navigation mode.")
(defalias 'mand-mode #[nil "ÀÂÄ!ˆÆÇ!ÈLˆÆÉ!ÈLˆÆÊ!ÈLˆÆË!ÈL‡" [mand-mode major-mode "Mandelbrot" mode-name use-local-map mand-mode-map make-local-variable mand-requested-bounds nil mand-plotting-bounds mand-overlay-list mand-character-rectangle-size] 2 "\
Major mode for navigating mandelbrot sets.
\\<mand-mode-map>
\\[mand-zoom-in] magnifies the area around the mouse click by a factor of two.
\\[mand-zoom-out] zooms out, placing the point clicked upon at the center
	of the new screen.
\\[mand-refresh] recalculates the display.  If you have changed the
	size of the window, the new plot is resized to fit within the
	new bounds.
The arrow keys shift the viewing area.
\\[mand-circle-radius-two] zooms out to your original position, viewing the
	entire Mandelbrot set.

If your display supports a lot of colors, you may want to increase the
value of the variable `mand-num-fleeing-colors', which specifies the
number of different colors to use to display fleeing points.

\\{mand-mode-map}" nil])
(byte-code "ÀÁÂÃ#ˆÄÅ!‡" [put mand-mode mode-class special provide mandel] 4)
