Logo by Fiery - Contribute your own Logo!
News: Did you know ? you can use LaTex inside Postings on fractalforums.com!
 
*
Welcome, Guest. Please login or register. March 23, 2017, 01:12:00 PM


Login with username, password and session length



Pages: [1]   Go Down
  Print  
Share this topic on DiggShare this topic on FacebookShare this topic on GoogleShare this topic on RedditShare this topic on StumbleUponShare this topic on Twitter
Author Topic: GCC sources of MB3D formulas  (Read 364 times)
0 Members and 1 Guest are viewing this topic.
DarkBeam
Global Moderator
Fractal Senior
******
Posts: 2496


Fragments of the fractal -like the tip of it


« on: December 01, 2016, 07:13:24 PM »

Too bad the biggest part does not exist. I made all by hand.

But now finally I am beginning to try Knighty's code ( http://www.fractalforums.com/tutorials/re-blobby-reknighty/ ). So;
Code:
// from JIT Mandelcup of Pupukuusikko :D
#include <math.h>

void __attribute__((fastcall)) Formula(
             double* x,      // [eax]
             double* y,      // [edx]
             double* arg,    // [ebp+8], points to TIteration3Dext.C1
             void* dummy     // so we end w/ ret 8 as delphi expects
             );

          
__attribute__((packed)) struct TIteration3Dext {
double Cw,Rold,RStopD,x,y,z,w; // use with neg indizes before C1. w is also used for 3d ifs and abox analytic DE
double Px, Py, Pz;             //      actual position, never change these!  Can be used as input.
double Cx, Cy, Cz;             //+24   these are the constants for adding. Pxyz or the julia seed.  Cw is @-56 (begin of struct)
void*  PVar;                   //+48   the actual formulas adress of constants and vars, constants at offset 0 increasing, user vars below -8
float  SmoothItD;              //+52
double Rout;                   //+56   the square of the vector length, can be used as input
int    ItResultI;              //+64
int    maxIt;                  //+68
float  RStop;                  //+72
int    nHybrid[6];             //+76   all formulas iteration counts or single weights in interpol-hybrid
void*  fHPVar[6];              //+100  all formulas pointer to constants+vars, PVars-8=0.5, use PVar for the actual formula
void*  fHybrid[6];             //+124  the formulas adresses
int    CalcSIT;                //+148
int    DoJulia;                //+152
float  LNRStop;                //+156
int    DEoption;               //+160
float  fHln[6];                //+164  for SmoothIts
int    iRepeatFrom;            //+188
double OTrap;                  //+192
double VaryScale;              //+200  to use in vary by its
int    bFirstIt;               //+208  used also as iteration count, is set to 0 on it-start
int    bTmp;                   //+212  tmpBuf, free of use.
double Dfree1;                 //+216
double Dfree2;                 //+224
double Deriv1;                 //+232  for 4D first deriv or as full derivs
double Deriv2;                 //+240
double Deriv3;                 //+248
float  SMatrix4[4][4];         //+256  for 4d rotation, used like most other values only by the programs iteration loop procedure
};

__CRT_INLINE double __cdecl Hypot(double x,double y) { return sqrt(x*x+y*y); }
__CRT_INLINE double __cdecl length(double x,double y,double z) { return sqrt(x*x+y*y+z*z); }
__CRT_INLINE double __cdecl recip (long double _x)
{
  double res;
  __asm__ ("fld1
"
   "fdivp": "=t" (res) : "0" (_x));
  return res;
}

// fastcall is not quite delphi fastcall.
// first two args are ok, third is in ecx in delphi, on stack here.
void __attribute__((fastcall)) Formula(
             double* x,      // [eax]
             double* y,      // [edx]
             double* arg,    // [ebp+8], points to TIteration3Dext.C1
             void* dummy     // so we end w/ ret 8 as delphi expects
             ) {
  // Compute ptr to proper start of TIteration3Dext struct.
  struct TIteration3Dext* cfg = (struct TIteration3Dext*)(arg-7);
  int* UserV = (int*)(cfg->PVar-12); // beginning of int vars
  double* UserV2 = (double*)(cfg->PVar-12-16); // beginning of dbl vars
  // no cns used!
  double temp, z_y, z_x, r;
  double mag1, mag2;
  double Scale = UserV2[0];
  double Shape = UserV2[-1]; // AAARRGGHH neg indices but it workssss :P
  
  // stereographic projection, modified a bit
  r = length(cfg->x,cfg->y,cfg->z);
  if (UserV[0]!=0) {
     cfg->x =cfg->x/r; cfg->y =cfg->y/r;
  }
  cfg->z = (cfg->z/r)+Shape;
  
  if (UserV[-1]!=0) {
     cfg->z =cfg->z*cfg->z; Shape = Shape*Shape;
  }
  
  if (UserV[-2]!=0) {
    temp = cfg->z;
  } else {
    temp = recip(cfg->z);
  }
  
  z_x = cfg->x*temp; z_y = cfg->y*temp;
 
  //complex multiplication
  temp = z_x*z_x-z_y*z_y;
  z_y = z_x*z_y; z_y += z_y;
  z_x = temp;
  
  temp = Scale*(1.+(Shape*Shape));
  //z_x = z_x*temp;
  //z_y = z_y*temp;

  
  //p = vec3(2.*z.x,2.*z.y,dot(z,z)-1)/dot(z.z+1);
  
  // inverse stereographic
  mag1 = z_x*z_x+z_y*z_y;
  mag2 = recip(mag1+1.); mag1 = mag1-1.;
              
  cfg->x = temp*mag2;
  cfg->y = z_y*cfg->x;
  cfg->x *= z_x;
  cfg->z = mag1*mag2;
  
  temp = r*r;//+Offset3;
  
  cfg->x = cfg->x * temp + cfg->Cx;
  cfg->y = cfg->y * temp + cfg->Cy;
  cfg->z = cfg->z * temp + cfg->Cz;
}
« Last Edit: December 01, 2016, 07:21:43 PM by DarkBeam » Logged

No sweat, guardian of wisdom!
DarkBeam
Global Moderator
Fractal Senior
******
Posts: 2496


Fragments of the fractal -like the tip of it


« Reply #1 on: December 22, 2016, 01:11:09 PM »

Idk how to add the car glass color help? afro (Credit to Eiffie Shiny Toy!!!!!) A Beer Cup


* eiffiecar.jpg (40.23 KB, 750x562 - viewed 20 times.)
* testIFS.m3f (1.79 KB - downloaded 12 times.)
Logged

No sweat, guardian of wisdom!
DarkBeam
Global Moderator
Fractal Senior
******
Posts: 2496


Fragments of the fractal -like the tip of it


« Reply #2 on: December 22, 2016, 01:19:39 PM »

Source code I forgot sad

* eiffiecar.zip (2.7 KB - downloaded 16 times.)
Logged

No sweat, guardian of wisdom!
knighty
Fractal Iambus
***
Posts: 807


« Reply #3 on: December 22, 2016, 01:23:16 PM »

Cool!
 Repeating Zooming Self-Silimilar Thumb Up, by Craig
Logged
DarkBeam
Global Moderator
Fractal Senior
******
Posts: 2496


Fragments of the fractal -like the tip of it


« Reply #4 on: December 22, 2016, 01:27:37 PM »

 A Beer Cup Thanks! Now everything works as expected, you may reuse the code to do most anything imaginable
except trigs (not done yet but just copypaste those already done), wink and the rotations, and the single precision stuff (also used for rotations!)
so ... good luck A Beer Cup
I will do the Kleinian asap hopefully!
Logged

No sweat, guardian of wisdom!
DarkBeam
Global Moderator
Fractal Senior
******
Posts: 2496


Fragments of the fractal -like the tip of it


« Reply #5 on: January 04, 2017, 10:54:23 AM »

Premade project of Kleinian - everybody can modify it, make sure to credit the authors A Beer Cup

* JosKn-KleinIFS.zip (8.67 KB - downloaded 29 times.)
« Last Edit: January 04, 2017, 11:19:23 AM by DarkBeam » Logged

No sweat, guardian of wisdom!
DarkBeam
Global Moderator
Fractal Senior
******
Posts: 2496


Fragments of the fractal -like the tip of it


« Reply #6 on: February 01, 2017, 06:44:01 PM »

UPDATE!
Added current final (?) formula src code grin
EDIT - FIXED the weird bug that prevented other difs shapes to render after JosKlein.

* JosKn-KleinIFS.zip (18.89 KB - downloaded 17 times.)
« Last Edit: February 01, 2017, 07:13:15 PM by DarkBeam » Logged

No sweat, guardian of wisdom!
Pages: [1]   Go Down
  Print  
 
Jump to:  

Related Topics
Subject Started by Replies Views Last post
Convergent formulas on Mb3D! Mandelbulb 3d DarkBeam 1 535 Last post April 07, 2011, 06:39:22 PM
by DarkBeam
Kleinian groups - an immense collection with sources! Let's collaborate on something! DarkBeam 12 2975 Last post February 13, 2015, 04:06:20 PM
by Adam Majewski
Try to count light sources Movies Showcase (Rate My Movie) Buddhi 3 349 Last post November 03, 2013, 12:19:37 AM
by taurus
need help on formulas in mb3d Mandelbulb 3d blu art 1 348 Last post April 30, 2014, 09:52:27 AM
by DarkBeam
Adding formulas from MB3D and others? Feature Requests « 1 2 » cKleinhuis 23 882 Last post February 19, 2015, 09:26:26 PM
by taurus

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines

Valid XHTML 1.0! Valid CSS! Dilber MC Theme by HarzeM
Page created in 0.361 seconds with 29 queries. (Pretty URLs adds 0.02s, 2q)