From: ptkwt@...1.aracnet.com (Phil Tomson) Date: 2003-05-20T00:57:45+09:00 Subject: ANN: SuperShape I figured I needed a bit of practice creating C-extensions and Tk apps, so that's why I did this... that and it's kind of cool to play with. ....Well, to be honest, I'm avoiding working on my term paper ;-) What is a supershape? It's like this: A Belgian Biologist named Johan Gielis discovered a formula that can create a vast diversity of natural shapes. By tweaking four parameters it can produce everything from simple triangles and pentagons, to stars, spirals and petals. For more info on Super Shapes check out this article in Nature: http://www.nature.com/nsu/030331/030331-3.html Also, check out this paper which goes into some of the math and suggests settings to try: http://astronomy.swin.edu.au/~pbourke/curves/supershape/ REQUIREMENTS: Tk gcc (to compile the C-extension) INSTALLATION cd ext ruby extconf.rb make sudo make install What you get: SuperShapes.so - This is a shared lib that you can require. RUNNING THE EXAMPLE: ruby tk_supershape.rb tk_supershape.rb plots the supershapes on a TkCanvas. It allows you to tweak the four parameters (m, n1, n2 and n3 - see the reference above for values to try for interesting effects) and then see the resulting shape. Have fun. Phil