Re: Superformula with Perl?



On 28 Dec 2006 03:47:05 -0800, "guba@xxxxxxxxxx" <guba@xxxxxxxxxx>
wrote:

Hello,

I am wondering how parametric formulas like the Superformula
http://en.wikipedia.org/wiki/Superformula
can be drawn with Perl. GD or ImageMagick has only some graphic
primitives and I can not see how this could be done which such
programs. Or can Perl API to a mathe library be used to
draw such graphs? Thank you for hints!

Günter

If you have gnuplot going, put these 2 scripts into a dir,
and run "gnuplot super", it will give an animation of sorts.
Play with the values m n1 n2 n3.

######## snip super ####################
# Show some of the new polar capabilities.
#
unset border
set clip
set polar
set xtics axis nomirror
set ytics axis nomirror
set zeroaxis
set trange [0:12*pi]

a=1
b=1

m=4
n1=1
n2=1
n3=8

butterfly(x) = ( ( abs(( (cos(m*x)/4))/a) )**n2
+ ( abs(( (sin(m*x)/4))/b) )**n3 )**(-1/n1)

set samples 800
set title "SuperFormula hold control-c to exit"
unset key
plot butterfly(t)
pause .1 #-1 "Hit return to continue"

count=0
load 'looper'

##### END ####################################

##### snip looper ##########################3

m= m + .1
n1= n1 + .1
n2= n2 + .1
n3= n3 + .1

print m; print n1; print n2; print n3;

replot
pause .1
count = count +1
if(count < 1000) reread
##########################################


zentara
--
I'm not really a human, but I play one on earth.
http://zentara.net/japh.html
.


Quantcast