## superformula variation

2007-02-15
2013-04-25
• hi all,

i have recently built in the superformula into mutatorkammer, and i think you might
be interested in a nice transformation, with this transformation different kinds of flower shaped

a detailed description about the formula can be found here:
http://local.wasp.uwa.edu.au/~pbourke/surfaces_curves/supershape/

here is one version which could take 6 additional parameters, but 2 of them can be neglected, namely a and b
on the page above the author suggested to leave a and b to 1

i have no delphi compiler right now ;(
but if anyone built this one in it would be great fun!

// The super Shape Function
// as a Transformation of a 2d Point - Excerpt from Mutatorkammer SUPER Function !

// Description:
// the supershape function in 2d normaly gives a curve
// in 2d space, meaning, only one value from -PI to +PI generates the shape
// this function transforms a point, calculating the length and the angle of the current
// pixel as input to the function, the returned value is then scaled to original length
//
// by the way: this formula would also do fine if used in the nonlinear transformations Apophysis uses!
//
// c.Kleinhuis 2007 - use at your own risk ! - but use it freely !
//

double super(double theta,double a,double b,double n1,double n2,double n3,double m){
double one= pow( fabs(cos(m*theta/4)/a),n2);
double two= pow( fabs(sin(m*theta/4)/b),n3);
return pow((one+two),-1/n1);
}

// Parameter x is the point you want to transform
// the parameters y,z and w are the 6 values for the supershape formula,
// taking real and imaginary parts from them gives us the 6 values we need!
// be sure to read http://local.wasp.uwa.edu.au/~pbourke/surfaces_curves/supershape/
// for an explanation of the values

// the last parameter (imaginary part of w) is the amount of angular repeats, setting this
// to a integer number gives you spikes - the other parameters are too hard to explain ;)
// just play around  ..
// MyComplex calc(MyComplex x,MyComplex y,MyComplex z,MyComplex w )
{
double a=std::real(y);
double b=std::imag(y);
double n1=std::real(z);
double n2=std::imag(z);
double n3=std::real(w);
double m=std::imag(w);
double theta=atan2(std::imag(x),std::real(x));
double l=sqrt(std::real(x)*std::real(x)+std::imag(x)*std::imag(x));
double res=super(theta,a,b,n1,n2,n3,m);
return     MyComplex( l*res*cos(theta), l*res*sin(theta)  );
}

• Piotr Borys
2007-02-16

:) thanks a lot! Yeah.. Paul Bourke is a great source ;)
Thanks!

• cyberxaos
2007-02-17

Wow, wow, wow... *goes off to implement super shape function*

• cyberxaos
2007-02-18

FYI, I've just implemented the supershape and released it over at my dA journal:  http://cyberxaos.deviantart.com/journal/11868090/

Thanks for pointing this out!

• oh, i tried the version out, but it behaves somehow odd, will try it out, thank you for implementing !

• i tried it out, the super shapes are clearly visible, but, we should make sure the function behaves like
we want, it should be a transformation, i think it should scale the dot along its norm ( to center)

i try to make a 2d plott of the desired function, the way it is implemented above, i think it is not right ;(

• cyberxaos
2007-02-18

Thanks Christian -- I saw the supershapes in my implementation, but I'm no mathematician, so I would love it if you would educate me ;-)

• ehrm, i am no mathematician either, but i have those grid shaped patterns
http://flam3.com/flame.pdf - appendix a

i am working on it right now, i will post news here then!

• cyberxaos
2007-02-18

Ahhhh... I see what you mean when you say you want the function to behave like a transformation. Ehrm, I eagerly await your news ;-)

• oh, i have just checked the result, and it looks quite good, multiplicating with the original length, does the job,
i was just a bit confused about the nice and clear shapes but the version above does the job as wanted ...
a mention of me would be nice ;)

• cyberxaos
2007-02-19

Michael Faber (http://michaelfaber.deviantart.com) just pointed out that I can make the supershpaes transforms if I use the input radius, instead of a blur value (as I was using) to create solid shapes.  I'll release an updated version of Apo with the transformation version of the supershapes variation as well as the original, solid shape, variation.  Of course there should be a mention of you!  I apologize for the oversight in my original journal post.  If you read the comments, you'll see that I was effusing about you in the comments below, though ;-)

Get the version with supershapes implemented as transforms here: http://cyberxaos.deviantart.com/journal/11870754/

• lol, thank you ;)

ok, it seems a little odd, but i just wanted to download the source code, there is some glitches, that look like highlites,

i see, you use a blur function to make the shape of the formula appear, that is surely a useful variations, but i just wanted to try out how the supershape formula behaves in combination with other formulas, though i was a bit dissapointed ;) because the other
variations behaved other, i think the quadrat function makes uses of this bluring function ;)

great!