From: David Trudgett
Subject: Mandelbrot Set generator (source code available)
Date: 
Message-ID: <m3u0bkhp32.fsf@rr.trudgett>
Hi everyone,

In case anyone is interested, I have posted to my website a snapshot
of the code I'm currently working on. The code has been developed only
for my personal use, but others may find it interesting or
useful. (Note: I don't know if this works on anything besides
CMUCL/CLX on Linux.)

http://www.zeta.org.au/~wpower/dkt/programs/fractal.lisp 

fractal.lisp contains a Mandelbrot Set generator. You can zoom in by
clicking the part of the image you want to magnify. Press 'q' to close
the window.


http://www.zeta.org.au/~wpower/dkt/programs/graphics.lisp

graphics.lisp contains a few simple computer graphics algorithms (line
and circle drawing).


http://www.zeta.org.au/~wpower/dkt/programs/clx-drawing-window.lisp

clx-drawing-window.lisp contains some code for creating a simple
drawing window using CLX. The previous two packages depend on it.


http://www.zeta.org.au/~wpower/dkt/programs/utils.lisp

utils.lisp contains one or two small generic utility
functions. FLATTEN is the only one used by clx-drawing-window.


http://www.zeta.org.au/~wpower/dkt/programs/mand.lisp

mand.lisp is a quick kick-start into Mandelbrot. Assumes that CLX is
loaded.


A sample image gallery is available at:

http://www.zeta.org.au/~wpower/dkt/mandelbrot.html


Hope you find it useful. Don't expect blinding speed. No warranty as
usual. All the above links can be found on my home page also.


Cheers,

David





-- 

David Trudgett
http://www.zeta.org.au/~wpower/

First they ignore you, 
then they laugh at you, 
then they fight you,
then you win!

    -- Mohandas Gandhi

From: David Trudgett
Subject: Re: Mandelbrot Set generator (source code available)
Date: 
Message-ID: <m3ek2kj38z.fsf@rr.trudgett>
David Trudgett <······@zeta.org.au.nospamplease> writes:

> In case anyone is interested, I have posted to my website a snapshot
> of the code I'm currently working on. The code has been developed only
> for my personal use, but others may find it interesting or
> useful. (Note: I don't know if this works on anything besides
> CMUCL/CLX on Linux.)
>
> http://www.zeta.org.au/~wpower/dkt/programs/fractal.lisp 

FRACTAL now also contains Julia set plotting. I made use of CL's
complex number support for this one:

    (defun julia-test (zpoint max-iter)
      (declare (type complex zpoint)
               (type fixnum max-iter))
      (do ((count 0 (1+ count))
           (zn zpoint (+ (* zn zn) *julia-seed*)))
          ((or (> count max-iter) 
               (> (abs zn) 2.0d0))
           count)
        (declare (type complex zn)
                 (type fixnum count))))


Very nice. In comparison, this is what I did for the Mandelbrot Set
(actually, the CPOINT parameter was two real parameters before I
remembered CL's complex number support and decided to retrofit some
cuteness):

    (defun mandel-test (cpoint max-iter)
      (declare (type complex cpoint)
               (type fixnum max-iter))
      (let ((square-limit 4.0d0)
            (xval (realpart cpoint))
            (yval (imagpart cpoint)))
        (declare (type double-float square-limit xval yval))
        (do ((count 0 (1+ count))
             (zx 0.0d0 (+ xval (- (* zx zx) 
                                  (* zy zy))))
             (zy 0.0d0 (+ yval 
                          (* 2 zx zy))))
            ((or (> count max-iter) 
                 (> (abs (+ (* zx zx) 
                            (* zy zy))) 
                    square-limit))
             count)
          (declare (type double-float zx zy)
                   (type fixnum count)))))


Note for anyone who actually wants to use this code: right clicking in
the Mandelbrot Set view now gets you the corresponding Julia set. It
tells you that in the source code anyway, so this is redundant, right?
:-)


> http://www.zeta.org.au/~wpower/dkt/programs/clx-drawing-window.lisp

This has now been updated with additional functionality (allows
binding of actions to left, middle and right clicks).


Colouring for the Julia sets could do with some improvement, so I may
look at that next.

I'd be happy if anyone would let me know if they have this code
working on other platforms besides CMUCL on Linux. It depends on CLX,
so MS Windows platforms are out unless you are running X on Windows.

A Julia set image gallery is at:

    http://www.zeta.org.au/~wpower/dkt/julia.html



David


-- 

David Trudgett
http://www.zeta.org.au/~wpower/

FORTH IF HONK THEN
From: David Trudgett
Subject: Fast Mandelbrot and Julia sets generator (source code available)
Date: 
Message-ID: <m3pslyk62g.fsf_-_@rr.trudgett>
Hi everyone,

For all those who have downloaded previous versions of my fractal
code, and anyone else who is interested, I have been able to perform
some optimisations on the pixel plotting, and the code is now two or
three times faster than before. It also uses a new ice-blue colour
scheme, and the previously colour-challenged Julia sets now look
better (in my colour-challenged opinion).

Updated code:

    http://www.zeta.org.au/~wpower/dkt/programs/utils.lisp
    http://www.zeta.org.au/~wpower/dkt/programs/clx-drawing-window.lisp
    http://www.zeta.org.au/~wpower/dkt/programs/fractal.lisp

Also, julia.lisp shows a slide show of the Julia sets on my web page
gallery ('q' to close each image):

    http://www.zeta.org.au/~wpower/dkt/programs/julia.lisp


The new ice-blue Julia sets gallery can be found at:

    http://www.zeta.org.au/~wpower/dkt/julia.html


David



-- 

David Trudgett
http://www.zeta.org.au/~wpower/

All these men who were going to murder or to torture the famishing and
defenseless creatures who provide them their sustenance had the air of
men who knew very well that they were doing their duty, and some were
even proud, were "glorying" in what they were doing.

    -- Leo Tolstoy, "The Kingdom of God is Within You"
From: Alan Crowe
Subject: Re: Fast Mandelbrot and Julia sets generator (source code available)
Date: 
Message-ID: <86lkwarn7y.fsf@cawtech.freeserve.co.uk>
David Trudgett <······@zeta.org.au.nospamplease> writes:

> Hi everyone,
> 
> For all those who have downloaded previous versions of my fractal
> code, and anyone else who is interested, I have been able to perform
> some optimisations on the pixel plotting, and the code is now two or
> three times faster than before. It also uses a new ice-blue colour
> scheme, and the previously colour-challenged Julia sets now look
> better (in my colour-challenged opinion).
> 
> Updated code:
> 
>     http://www.zeta.org.au/~wpower/dkt/programs/utils.lisp
>     http://www.zeta.org.au/~wpower/dkt/programs/clx-drawing-window.lisp
>     http://www.zeta.org.au/~wpower/dkt/programs/fractal.lisp
> 
> Also, julia.lisp shows a slide show of the Julia sets on my web page
> gallery ('q' to close each image):
> 
>     http://www.zeta.org.au/~wpower/dkt/programs/julia.lisp
> 
> 
> The new ice-blue Julia sets gallery can be found at:
> 
>     http://www.zeta.org.au/~wpower/dkt/julia.html
> 

Wow, that is wonderful. Thank you David. I will be studying
the code to see how its done. If I can tear myself away from
playing with it :-)

FRACTAL> (setf *read-default-float-format* 'double-float)
DOUBLE-FLOAT
FRACTAL> (JULIA #C(-0.7752609226612173 0.12427180462405449)
       :XSTART
       -2.0d0
       :YSTART
       -2.0d0
       :X-EXTENT
       4.0d0
       :IMAGE-WIDTH
       550
       :IMAGE-HEIGHT
       550)

is very pretty, it reminds me of a friends soggoth plushie.

Alan Crowe
Edinburgh
Scotland
From: David Trudgett
Subject: Re: Fast Mandelbrot and Julia sets generator (source code available)
Date: 
Message-ID: <m3u0axim21.fsf@rr.trudgett>
Alan Crowe <····@cawtech.freeserve.co.uk> writes:

> David Trudgett <······@zeta.org.au.nospamplease> writes:
>
>> Updated code:
>> 
>>     http://www.zeta.org.au/~wpower/dkt/programs/utils.lisp
>>     http://www.zeta.org.au/~wpower/dkt/programs/clx-drawing-window.lisp
>>     http://www.zeta.org.au/~wpower/dkt/programs/fractal.lisp
>> 
>
> Wow, that is wonderful. Thank you David. 

Hi Alan! Thanks for the compliment! I was beginning to think no one
cared! ;-) I guess my meagre beginner's efforts do pale in comparison
to the thousands of Mandelbrot and Julia sets already on the
web... but not too many of them come with Lisp source code attached,
though, I'll bet.


> I will be studying the code to see how its done. 

I doubt you'll find anything too mind-numbingly wonderous in there!
:-) But it does the job for my purposes. When I graduate to 3D stuff,
I'll revisit Mandelbrot and Julia to see if I can't get some decent 3D
versions of them.


> If I can tear myself away from playing with it :-)

It does get compelling for a while, doesn't it? It's amazing that such
simple equations can produce designs of that complexity.


>
> FRACTAL> (setf *read-default-float-format* 'double-float)
> DOUBLE-FLOAT
> FRACTAL> (JULIA #C(-0.7752609226612173 0.12427180462405449)
>        :XSTART
>        -2.0d0
>        :YSTART
>        -2.0d0
>        :X-EXTENT
>        4.0d0
>        :IMAGE-WIDTH
>        550
>        :IMAGE-HEIGHT
>        550)
>
> is very pretty, 

Ah, very nice.

> it reminds me of a friends soggoth plushie.

... and that in a language I understand is?  :-)


David



-- 

David Trudgett
http://www.zeta.org.au/~wpower/

Most of the major ills of the world have been caused by well-meaning
people who ignored the principle of individual freedom, except as
applied to themselves, and who were obsessed with fanatical zeal to
improve the lot of mankind-in-the-mass through some pet formula of
their own. The harm done by ordinary criminals, murderers, gangsters,
and thieves is negligible in comparison with the agony inflicted upon
human beings by the professional do-gooders, who attempt to set
themselves up as gods on earth and who would ruthlessly force their
views on all others - with the abiding assurance that the end
justifies the means.

    -- Henry Grady Weaver (author), 
       (from The Mainspring of Human Progress) 
From: Brandon Werner
Subject: Re: Fast Mandelbrot and Julia sets generator (source code available)
Date: 
Message-ID: <2006021715011016807-brandonwerner@maccom>
Just to let you know, after hacking a little (especially with Xlib and 
SBCL) on Mac OSX I got it to run just fine.

-- 
Brandon Werner
cl-semantic project administrator

http://common-lisp.net/project/cl-semantic/
http://www.brandonwerner.com

cl-semanic is a collection of RDF/OWL extraction and relationship 
parsing macros written in Common Lisp.

i pensieri stretti & il viso sciolto
From: David Trudgett
Subject: Re: Fast Mandelbrot and Julia sets generator (source code available)
Date: 
Message-ID: <m3psllilfh.fsf@rr.trudgett>
Brandon Werner <··············@mac.com> writes:

> Just to let you know, after hacking a little (especially with Xlib and
> SBCL) on Mac OSX I got it to run just fine.

Hey, that's great! If you can remember what you did, and you can
describe it in a couple of sentences (i.e., not to take up too much of
your time) then I'd be happy to include it as comments in the source,
or as a separate mini-howto file.

> cl-semanic is a collection of RDF/OWL extraction and relationship

I think you're missing a 't' in semantic.


>
> i pensieri stretti & il viso sciolto

I pensieri sciolti e il viso sciolto. Anything else is for cowards who
don't want morality to get in the way of their "real" work. ;-)


Thanks for letting me know you got the thing running on OSX.

Cheers,

David



-- 

David Trudgett
http://www.zeta.org.au/~wpower/

Centralization as a system is inconsistent with nonviolent structure
of society.

    -- Mohandas Gandhi