Kaleidoscope Script

226 views
Skip to first unread message

geezer

unread,
Jul 18, 2009, 5:16:17 PM7/18/09
to MathMap
I have installed Mathmap 1.3.4 alpha2 on a WinXP machine running Gimp
2.6.6, and I wanted to run the Kaleidoscope script. It gave a "Can not
parse" error, so I opened the Mathmap plugin and started inserting the
script one line at a time.

The error came on the line: rad=rad*min(X,Y);

I introduced two new variables (foo and bar) so that the section now
reads:

xr=r*rad;
foo=min(X,Y);
bar=foo*rad;
if xr<bar then
nr=xr;
else
ang=2*ang;
nr=bar*xr/R;
end;

This runs without error, and seems to generate a kaleidoscope image,
although I have no idea what one looked like originally.

My question is, why the error with rad=rad*min(X,Y); ?

Credit to Nathan deGargoyle for the original script, and to Photocomix
for making these scripts available on his deviantart page. Also to
everyone involved in making Mathmap available to us.

Here is the entire kaleidoscope.mm script (after the change):

====================================

filter kaleidoscope (image in, int ng: 2-10, float rot: 0-6.28319, int
sx: 0-2000, int sy: 0-2000, float rad: 0-100)
intang=2*pi/ng;
na=a+pi/2;
ang=intang/2-na%intang;
ang=rot+(intang/2-sqrt(ang^2));
xr=r*rad;
foo=min(X,Y);
bar=foo*rad;
if xr<bar then
nr=xr;
else
ang=2*ang;
nr=bar*xr/R;
end;
nx=nr*cos(ang);
ny=nr*sin(ang);
nx=(nx+sx)%(W-1)-(X-1);
ny=(ny+sy)%(H-1)-(Y-1);
in(xy:[nx,ny])
end

====================================

Mark Probst

unread,
Jul 19, 2009, 6:46:54 AM7/19/09
to mat...@googlegroups.com
On Sat, Jul 18, 2009 at 11:16 PM, geezer<wec...@gmail.com> wrote:
> I have installed Mathmap 1.3.4 alpha2 on a WinXP machine running Gimp
> 2.6.6, and I wanted to run the Kaleidoscope script. It gave a "Can not
> parse" error, so I opened the Mathmap plugin and started inserting the
> script one line at a time.
>
> The error came on the line:  rad=rad*min(X,Y);

For me the error message is "Cannot assign to filter argument `rad'.".
It's possible that there's a bug in the Windows alpha release which
gives the generic message you're getting. I'll investigate that -
unfortunately I still don't have a working Windows installation (have
been waiting for almost two months to get a defective HD replaced).

Still, there's no particularly good reason for why it shouldn't be
possible to use filter arguments as assignable variables. I'll put it
on the issues list.

Thanks for the report!

Mark

geezer

unread,
Jul 19, 2009, 12:36:02 PM7/19/09
to MathMap
Thanks for your quick reply Mark.

You are exactly correct - I did get the error "Cannot assign to filter
argument 'rad'.".
I should have pointed that out.

And thanks again for making it possible for us to use this wonderful
software.
Mathmap has recharged my brain.

Bill

photo...@gmail.com

unread,
Jul 23, 2009, 12:15:34 PM7/23/09
to MathMap
Hy Gezer thank to find a workaround to use the Kaleidoscope script
I

Cosmo

unread,
Feb 4, 2011, 7:33:01 PM2/4/11
to mat...@googlegroups.com
Hello MathMappers,

I really like the MathMap kaleidoscope.mm plugin included in the most recent release. I discovered it through this group.  I'm using it in GIMP 2.6.10 on Ubuntu 10.10.  I don't like the old Gimp kaleidoscope plugin because it has such a small preview window.  The repetition of layers by changing the MM rad value is a feature it does not include, a rather nice one I might say.   Kaleidoscoping has become important to my geometric art/craft practice which I like to call SpaceCraft Engineering, you can see more about that here: http://cosmic-spacecrafts.blogspot.com.  Perhaps a blog post on kaleidoscoping is in order....

I'm posting to let you folks know about my modification that makes the script more versatile.  I noticed that one thing this script lacks is the ability to change the center point for the kaleidscoping (thus the center remains similar).  I also noted that the sx and sy values don't change the image much when you slide them, but act more like a binary switch because the image is one way when the value is 0, and another way when the value is 1-2000. 

I was a little way into a tutorial of MathMap, trying to learn the laguage in hopes of adding a center change function to the script when I decided to just make the sx and sy values a float from 0-1. That resulted in the effect I was looking for, being able to change the center of the image.  Here is the script with ever-so-slight modification:

filter kaleidoscope (image in, int ng: 2-20, float rot: 0-6.28319, float sx: 0-1, float sy: 0-1, float rad: 0-100)

intang=2*pi/ng;
na=a+pi/2;
ang=intang/2-na%intang;
ang=rot+(intang/2-sqrt(ang^2));
xr=r*rad;
foo=min(X,Y);
bar=foo*rad;
if xr<bar then
nr=xr;
else
ang=2*ang;
nr=bar*xr/R;
end;
nx=nr*cos(ang);
ny=nr*sin(ang);
nx=(nx+sx)%(W-1)-(X-1);
ny=(ny+sy)%(H-1)-(Y-1);
in(xy:[nx,ny])
end

Much gratitude to the developers and contributors of this language and script !


Cheers,
~Cosmo

photo...@gmail.com

unread,
Feb 7, 2011, 12:20:20 PM2/7/11
to MathMap
thank Cosmo i missed a lot that feauture
Reply all
Reply to author
Forward
0 new messages