Thursday, March 6, 2014

Mandelbrot set with AX and other fun jobs

copy and paste the code into a Job and enjoy :)

Check out this thread for more fun: Art Of Creation – Dynamics AX Blog


(THX to Lasse from EG)
static void totallyuseless(Args _args)
{
    int rows = 40, cols = 80;
    int maxIter = 256;
    real fVRct = -2.5, fVRctImg=-1.00,fMagLevel=0.05,fCImg=0,fC,fZ,fZImg,fZSqr,fZImgSqr;
    int X = 1,Y = 1,N = 0;
    str chars = "▓▒▒░¤ghijklmnoprstuvwxyz123456▒890!#╧%/()=@£$?{[]}*ABCDE█GHIJ█LMNOPQRSTUVXY@";
    str printLine;
    ;    
    window cols, rows at 50,20;
    
    Y = 1;
    while(Y < rows)
    {
      fcImg = fVRctImg + Y * fMagLevel;
      printLine = "";
      X = 1;
      while(X < cols)
      {
        fC = fVRct + X * fMagLevel;
        fZ = fC;
        fZImg  = fCImg;

        N = 0;
        while(N < maxIter)
        {
          fZSqr = fZ * fZ;
          fZImgSqr = fZImg  * fZImg;
          fZImg = 2 * fZ * fZImg + fCImg;
          fZ = fZSqr - fZImgSqr + fC;
          if(fZImgSqr+fZImgSqr > 4)
          {
            break;
          }
          n++;
        }
        if( N > StrLen(Chars))
        {
          n = StrLen(Chars);
        }
        printLine += subStr(chars, N, 1);
        x++;
      }
      print printLine;
      y++;
    }
    pause;
}

No comments:

Post a Comment

feel free to leave a comment or ask questions!