From: LuisGLopez
Subject: Beautiful patterns
Date: 
Message-ID: <1127353863.663710.121390@g14g2000cwa.googlegroups.com>
Hi!

I didn't know to post it here; maybe it's not very useful, and
certainly is *very* simple. I did it trying to go on getting my hands
on lisp, coding ideas from "The Armchair Universe", of A.K.Dewney. But
when looking at the result in my screen, it was just *so* beautiful,
that I needed to share with you.

The code is simple:

--------------------------------------
(defun calcular-color (valor)
  (round (* (expt 2 24) valor)))

(defun saltarín (&key (máximo 100000) (a -1000) (b 0.1) (c -10)
		      (x0 -1500.0) (y0 -1500.0) (x1 500.0) (y1 500.0))
  (open-window)
  (let ((ancho (/ *window-width*  (- x1 x0)))
	(alto  (/ *window-height* (- y1 y0))))
    (do ((x           0 (- y (* (signum x) (sqrt (abs (- (* b x)
c))))))
	 (y           0 (- a x))
	 (iteraciones 0 (1+ iteraciones)))
	((= iteraciones máximo))
      (set-color (calcular-color (/ iteraciones máximo)))
      (draw-point (round (+ (* ancho (- x x0))))
		  (round (+ (* alto  (- y y0))))))
    (xlib:display-force-output *dpy*)))
-------------------------------------
(I spare you from the graphics initialization/etc. code).

It's amazing how the patterns begin to full the window. They are so
exquisite, so charm in their endless details... I love how the new
"levels" of details come abruptly, almost in steps, as if the code says
"well, we are done with this part... now let's move on to another part
of the canvas".

I suggest to try this ones:
(saltarín :x0 -50 :y0 -50 :x1 50 :y1 50 :máximo 5000000)
(saltarín :x0 -15 :y0 -15 :x1 10 :y1 10 :máximo 5000000)
(saltarín :a 0.4 :b 1 :c 0 :x0 -4 :y0 -4 :x1 4 :y1 4 :máximo 700000)

But this is my favorite:
(saltarín :a (- pi) :b 0.3 :c 0.3 :x0 -23 :y0 -23 :x1 20 :y1 20
:máximo 700000)

The value of 'máximo' is very important. As you will see, the levels
of new details come along almost unpredictable, and if you cut it too
soon, you will loose a lot of beauty.

I hope you like it as much as I do.

Luis.

From: Frank Buss
Subject: Re: Beautiful patterns
Date: 
Message-ID: <1ixcue272t75t.3s7qgp3jvcwo$.dlg@40tude.net>
LuisGLopez wrote:

> I didn't know to post it here; maybe it's not very useful, and
> certainly is *very* simple. I did it trying to go on getting my hands
> on lisp, coding ideas from "The Armchair Universe", of A.K.Dewney. But
> when looking at the result in my screen, it was just *so* beautiful,
> that I needed to share with you.

[...]

> (I spare you from the graphics initialization/etc. code).

Nice graphics, I think I've read about it in Scientific American. I've
converted your code for CL-Canvas
(http://www.frank-buss.de/lisp/canvas.html). Graphics initialization is
included:

(defun calcular-color (valor)
  (round (* (expt 2 24) valor)))

(defun saltar�n (&key (m�ximo 100000) (a -1000) (b 0.1) (c -10)
		      (x0 -1500.0) (y0 -1500.0) (x1 500.0) (y1 500.0))
  (clc:show-canvas 500 500)
  (let ((ancho (/ clc:*width*  (- x1 x0)))
	(alto  (/ clc:*height* (- y1 y0))))
    (do ((x           0 (- y (* (signum x) (sqrt (abs (- (* b x)
                                                         c))))))
	 (y           0 (- a x))
	 (iteraciones 0 (1+ iteraciones)))
	((= iteraciones m�ximo))
      (clc:set-pixel (round (+ (* ancho (- x x0))))
		  (round (+ (* alto  (- y y0))))
                  (calcular-color (/ iteraciones m�ximo))))
    (clc:repaint)))

http://www.frank-buss.de/tmp/saltarin1.jpg
http://www.frank-buss.de/tmp/saltarin2.jpg

-- 
Frank Bu�, ··@frank-buss.de
http://www.frank-buss.de, http://www.it4-systems.de
From: LuisGLopez
Subject: Re: Beautiful patterns
Date: 
Message-ID: <1127392084.461586.134960@g49g2000cwa.googlegroups.com>
Hi!

Lovely screenshots! Thanks for the reply! But I feel that they lack the
"efervescent" feeling of the pattern being painted, don't they? Anyway,
beautiful.

I visited your page of CL-Canvas. Looks *amazing*! Do you know if it
would work in linux? That would be fantastic...
From: Frank Buss
Subject: Re: Beautiful patterns
Date: 
Message-ID: <pagien9chu7f.1i217qaag9ea0.dlg@40tude.net>
LuisGLopez wrote:

> But I feel that they lack the
> "efervescent" feeling of the pattern being painted, don't they? 

I don't understand this word.

> I visited your page of CL-Canvas. Looks *amazing*! Do you know if it
> would work in linux? That would be fantastic...

yes, this would work in Linux, too, if someone ports it :-)

-- 
Frank Bu�, ··@frank-buss.de
http://www.frank-buss.de, http://www.it4-systems.de
From: LuisGLopez
Subject: Re: Beautiful patterns
Date: 
Message-ID: <1127437523.573467.316540@g47g2000cwa.googlegroups.com>
Frank Buss ha escrito:

> LuisGLopez wrote:
>
> > But I feel that they lack the
> > "efervescent" feeling of the pattern being painted, don't they?
>
> I don't understand this word.

Maybe because it doesn't exist :(. I meant 'effervescent'; please
excuse my english.

>
> > I visited your page of CL-Canvas. Looks *amazing*! Do you know if it
> > would work in linux? That would be fantastic...
>
> yes, this would work in Linux, too, if someone ports it :-)
> 

Ouch; looks difficult ;)
From: Frank Buss
Subject: Re: Beautiful patterns
Date: 
Message-ID: <ns11r1vhvggn.1i61f2pmht2bq.dlg@40tude.net>
LuisGLopez wrote:

> Frank Buss ha escrito:
> 
>> LuisGLopez wrote:
>>
>>> But I feel that they lack the
>>> "efervescent" feeling of the pattern being painted, don't they?

perhaps it would effervesce more with some animation :-)

>> yes, this would work in Linux, too, if someone ports it :-)
> 
> Ouch; looks difficult ;)

it should be not too difficult, the Windows specific part just creates a
window and draws an offscreen image, which could be done with some X11
functions, included with some FFI lib, and a pixmap as well.

-- 
Frank Bu�, ··@frank-buss.de
http://www.frank-buss.de, http://www.it4-systems.de
From: Glenn M. Lewis
Subject: Re: Beautiful patterns
Date: 
Message-ID: <XxzYe.44$sp1.8@tornado.socal.rr.com>
OK, I'm a total newbie, running "LispBox-0.6" that I got from Peter Seibel's
online book:  http://www.gigamonkeys.com/book/  (And I'm still reading Chapter 5.)

I notice on your webpage that you say I need 3 things to try this out:
ASDF, hello-c.zip, and cl-canvas.zip.

OK... it looks like 'lispbox-0.6' comes with 'asdf.lisp' in its top-level
directory.  Cool.

Now, where do I extract the two ZIP files to "install" them into my
lispbox-0.6 package?  Do I need to do anything else to build/compile/point-to
them before I can try the code below?  (I'm another D -> Common Lisp wanna-be convert,
who is also a Rubyist with a substantial C/C++/Perl/OpenGL history, as way of introduction.  :-) )

Thank you very much in advance!
-- Glenn

Frank Buss wrote:
> Nice graphics, I think I've read about it in Scientific American. I've
> converted your code for CL-Canvas
> (http://www.frank-buss.de/lisp/canvas.html). Graphics initialization is
> included:
> 
> (defun calcular-color (valor)
>   (round (* (expt 2 24) valor)))
> 
> (defun saltar�n (&key (m�ximo 100000) (a -1000) (b 0.1) (c -10)
> 		      (x0 -1500.0) (y0 -1500.0) (x1 500.0) (y1 500.0))
>   (clc:show-canvas 500 500)
>   (let ((ancho (/ clc:*width*  (- x1 x0)))
> 	(alto  (/ clc:*height* (- y1 y0))))
>     (do ((x           0 (- y (* (signum x) (sqrt (abs (- (* b x)
>                                                          c))))))
> 	 (y           0 (- a x))
> 	 (iteraciones 0 (1+ iteraciones)))
> 	((= iteraciones m�ximo))
>       (clc:set-pixel (round (+ (* ancho (- x x0))))
> 		  (round (+ (* alto  (- y y0))))
>                   (calcular-color (/ iteraciones m�ximo))))
>     (clc:repaint)))
> 
> http://www.frank-buss.de/tmp/saltarin1.jpg
> http://www.frank-buss.de/tmp/saltarin2.jpg
> 
From: Frank Buss
Subject: Re: Beautiful patterns
Date: 
Message-ID: <1k420a27r0w1e$.11vsx6xppn08w.dlg@40tude.net>
Glenn M. Lewis wrote:

> I notice on your webpage that you say I need 3 things to try this out:
> ASDF, hello-c.zip, and cl-canvas.zip.

chances are good that it doesn't work, unless you've installed LispWorks,
because I've used a patched version of hello-c with LispWorks specific
callbacks. I've heard of new FFI packages, but don't know, if they are
complete and if they support CLISP, which looks like you are using, because
you are posting from a Windows system. If such a package exists, CL-Canvas
needs to be ported to use it.

-- 
Frank Bu�, ··@frank-buss.de
http://www.frank-buss.de, http://www.it4-systems.de
From: Raph
Subject: Re: Beautiful patterns
Date: 
Message-ID: <1127858636.996323.63240@f14g2000cwb.googlegroups.com>
I created an example of how to use GTK bindings to make a simple
application based on the original post.

The code requires CLISP and GTK, and works on Linux (with minor
modifications to the library paths in gtk-server.cfg) and Windows.

Go get http://www.gotlisp.com/gtk-drawing.tar.gz, uncompress into a
directory somewhere, run "clisp canvas.lisp", and hit "Start." Make
sure you have GTK installed and in your path. If you don't, go get it
from http://gimp-win.sourceforge.net/stable.html), and you should see a
nice picture. (If you get "file not found," it means GTK isn't found in
your path. Try typing gtk-demo. If nothing happens, you need to get GTK
into your path.)

More details at http://www.gotlisp.com/gtk-drawing.html.

Luis, you're right! It is pretty!

Thanks!

Raph