superformula variation

  • christian Kleinhuis

    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
    things can be made

    a detailed description about the formula can be found here:

    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
    // 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

      Piotr Borys - 2007-02-16

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

    • cyberxaos

      cyberxaos - 2007-02-17

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

    • cyberxaos

      cyberxaos - 2007-02-18

      FYI, I've just implemented the supershape and released it over at my dA journal:

      Thanks for pointing this out! 

    • christian Kleinhuis

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

    • christian Kleinhuis

      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

      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 ;-)

    • christian Kleinhuis

      ehrm, i am no mathematician either, but i have those grid shaped patterns - appendix a

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

    • cyberxaos

      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 ;-)

    • christian Kleinhuis

      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

      cyberxaos - 2007-02-19

      Michael Faber ( 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:

    • christian Kleinhuis

      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 ;)


      btw. the download you typed is not working right now!

      • Piotr Borys

        Piotr Borys - 2007-02-19

        I'm working on a regular variation based on this. It's quite nice, so far, but I need more investigation. It plays quite well with other variations. This way, the basic shape appears only when a triangle is reduced to almost nothing.
        When I get this finished, I'll put it to our official beta testers, and to you. Thanks for this link, brother :)

        cheers, Peter.


Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks