Logo by tomot - Contribute your own Logo!
News: Follow us on Twitter
 
*
Welcome, Guest. Please login or register. November 25, 2017, 04:29:35 AM


Login with username, password and session length


The All New FractalForums is now in Public Beta Testing! Visit FractalForums.org and check it out!


Pages: 1 [2] 3   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: _polyfold_sym and polyfoldsymIFS in mandelbulber 2  (Read 1328 times)
Description: As of version madelbulber v2.09 - is formula/transformation available?
0 Members and 1 Guest are viewing this topic.
mclarekin
Fractal Senior
******
Posts: 1738



« Reply #15 on: December 14, 2016, 04:23:09 AM »

So I gave Nifty a copy of Matt's code and told him to go away and study it. Nifty was not happy. fiery

        bool EXTRA_TRIG_FUNCTION=false;
       
   float rxy;
   float ratrack=pi2-pi2/folds;   //pi2 is 2*pi
   float rotadjust=-pi/folds  + FoldAdjust;     // I called folds splits in my original code...
// I called them splits because I didn't know
   float pintrack=pi/folds;      //what they were called.....
   float pi2splits=pi2/folds;
   float  i=0.0;    //why a float??  I was doing something with it... 
   
   float omega=atan(z.y,z.x);
   if (omega<0.0) {omega+=pi2;}    //so angle goes from 0 to 2pi instead of having negative part
   
   float rotate=0;   

   //I only wanted to do the kaleidoscope rotations on specific iterations
  // doing multiple polyfolds... you can do it every iteration or whatever- for cool effects
  // only do it on specific iterations- I was making kaleidoscopes out of 2d polyfolding

   if (RotateIter==n) {rotate=Rotate;}    //only do the rotation on a specific iteration

   
   while (omega>pi2folds && i<floor(folds+1.0)) {
         i+=1.0;
         
         if (EvenFolds) {rotate*=-1;}    //if you have an even number of folds, you can do 1/2 as
                                                                 //many rotations- it's sort of cool

            if (!EXTRA_TRIG_FUNCTION) {   //that is a NOT "!"  cheesy
               rotadjust+=ratrack;
               pintrack+=pi2folds;
               omega-=pi2folds;
            } else {     //with extra trig function, you don't need the above... just do the above instead
               omega-=pi2folds;
            }
         }

         if (EXTRA_TRIG_FUNCTION) {   // don't do this unless you absolutely love using transcendental functions
             z=length(z)*vec2(cos(omega),sin(omega));
         }

// if you don't have an even number of folds, you have to make an even number of rotations like the following:

      if (omega>pi2folds*.5 && !EvenFolds) {rotate*=-1;}

// pintrack is used to shift the fold center outwords- images follow

         vec2 z2=vec2(cos(pintrack),sin(pintrack));   

// splitrad is the distance from the center that the folds are shifted outwards
      
         z.xy-=z2*splitrad;
          rxy=length (z.xy);   
         
// rotadjust keeps every duplicate aligned correctly.        
          omega=atan(z.y,z.x)+rotadjust+rotate+FoldAdjust;
         z.xy=rxy * vec2(cos(omega),sin(omega));


   return z;


* carbuncle 444_aa3.jpg (216.02 KB, 1204x1200 - viewed 116 times.)
Logged
mclarekin
Fractal Senior
******
Posts: 1738



« Reply #16 on: December 14, 2016, 05:11:59 AM »

But hten he was "hooked" and came back with his version of the Initial Conditions. He had recoded it to remove some divisions. Then he showed me his first render, unfortunately  it did not look like it should.


Code:
uniform bool EvenFolds; checkbox[true]
uniform bool EXTRA_TRIG_FUNCTION; checkbox[false]

uniform float folds; slider[1,4,50]
uniform float splitrad; slider[0,0,50]
uniform float FoldAdjust; slider[0,0,50]
uniform int RotateIter; slider[0,1,50]
float Rotate;
float rotate = 0.0;
int n = 0;
int i = 0;
float pi2 = 2 * M_PI_F;
float pi = M_PI_F;
float rxy;
float omega;
float pintrack = pi / folds;
float pi2folds = pi2 / folds;
float ratrack = pi2 - pi2folds;
float rotadjust = -pintrack + FoldAdjust;       
omega = atan(z.y,z.x);
if (omega < 0.0) {omega += pi2;}    //so angle goes from 0 to 2pi instead of having negative part
//if (RotateIter == n) {rotate = Rotate;}    //only do the rotation on a specific iteration


* Nifty aaa1.jpg (131.18 KB, 728x437 - viewed 117 times.)
Logged
M Benesi
Fractal Schemer
****
Posts: 1075



WWW
« Reply #17 on: December 15, 2016, 01:51:09 AM »

 grin  cheesy

  K... I explain momentarily. 
Logged

mclarekin
Fractal Senior
******
Posts: 1738



« Reply #18 on: December 15, 2016, 02:18:43 AM »

As you can see , I have decided not to get my brain out of storage, and I am using young Nifty's clever young brain instead.

Later he came back with some more images. Sadly his code was still not working and I had to send him back to his room. Using the old " no working code means no dinner" threat.


* polyMenger not.jpg (212.65 KB, 958x441 - viewed 119 times.)
Logged
mclarekin
Fractal Senior
******
Posts: 1738



« Reply #19 on: December 15, 2016, 07:14:31 AM »

He then came back with this poor excuse for a polyfold menger.  Let me have a look at your code young man! police


* polyMenger aaa8.jpg (216.69 KB, 700x594 - viewed 121 times.)
Logged
M Benesi
Fractal Schemer
****
Posts: 1075



WWW
« Reply #20 on: December 15, 2016, 07:15:17 AM »

  So.. have a kaleidoscopic rotation polyfold thingy for M3D now.  

https://drive.google.com/open?id=0B0EcJQ49B_yOSUJzRXBDc3JSY0k





  Still need to split off the accordion functionnnnnn so it's standalone (in that gif, using old code), which is basically a souped up boxtiling function.



   @mcclarekin-  Getting up early, might or might not get in code tomorrow (big thing after work) so you might have to decipher the following if you want to play around before the rainy day on Friday (might have all afternoon on Friday (due to rain) to code and stuff!!) so....

https://drive.google.com/open?id=0B0EcJQ49B_yOS1Iyd2gzbl8tek0

« Last Edit: December 15, 2016, 07:30:21 AM by M Benesi » Logged

mclarekin
Fractal Senior
******
Posts: 1738



« Reply #21 on: December 15, 2016, 07:22:11 AM »

Then I remembered I had chosen not to use my brain this week, so I told Nifty you will have to seek guidance from Uncle Matt.

I noticeed Nifty was confused about rotate , "n" and how the "while"  loop works.


Code:
// Iter loop

//14-12-16

   //I only wanted to do the kaleidoscope rotations on specific iterations
  
// doing multiple polyfolds... you can do it every iteration or whatever- for cool effects
  
// only do it on specific iterations- I was making kaleidoscopes out of 2d polyfolding

//if (RotateIter == n) {rotate = Rotate;}    //only do the rotation on a specific iteration

if (omega > pi2folds && i < floor(folds + 1.0))
{

//i += 1;

if (EvenFolds == 0) {rotate *= -1;}
   {
//if you have an even number of folds, you can do half
//many rotations it's sort of cool

if (EXTRA_TRIG_FUNCTION != 0)//that is a NOT "!"  :D
{  
rotadjust += ratrack;
pintrack += pi2folds;
omega -= pi2folds;
}
else
{     //with extra trig function, you don't need the above... just do the above instead. what????
omega -= pi2folds;
}
}


if (EXTRA_TRIG_FUNCTION == 0)
{   // don't do this unless you absolutely love using transcendental functions

//z = length(z) * (float2){(cos(omega), sin(omega));
rxy = length(z.xy);
z.x = rxy * cos(omega);
z.y = rxy * sin(omega);
}



// if you don't have an even number of folds, you have to make an even number of rotations like the following:

if (omega > pi2folds * 0.5 && EvenFolds != 0) {rotate *= -1;}


// pintrack is used to shift the fold center outwords- images follow
// splitrad is the distance from the center that the folds are shifted outwards
//vec2 z2=vec2(cos(pintrack),sin(pintrack));  
//z.xy-=z2*splitrad;

z.x -= cos(pintrack) * splitrad;
z.y -= sin(pintrack) * splitrad;
rxy = length(z.xy);
// rotadjust keeps every duplicate aligned correctly.
omega = atan(z.y/z.x) + rotadjust + rotate + FoldAdjust;
//z.xy=rxy * vec2(cos(omega),sin(omega));
z.x = rxy * cos(omega);
z.y = rxy * sin(omega);

}

z = fabs( z );

if (z.x < z.y ) z.xy = z.yx;

if (z.x < z.z ) z.xz = z.zx;

if (z.y < z.z ) z.yz = z.zy;



//Rotation (Mandelbox Tab, - main rotation)
z = Matrix33MulFloat3(consts->fractal.mandelbox.mainRot, z);


z *= ScaleM;
DE *= ScaleM; // * Tweak


z.x -= OffsetM.x;

z.y -= OffsetM.y;

//
if (Enable.z == 1) // standard z.z condition for Menger Sponge

//{

if (z.z > 1.0) z.z -= OffsetM.z;

//}
//else
//{
// z.z -= OffsetM.z;
//}


* polyMenger3 bbb2.jpg (82.65 KB, 373x455 - viewed 189 times.)
Logged
mclarekin
Fractal Senior
******
Posts: 1738



« Reply #22 on: December 15, 2016, 08:32:05 AM »

I thought I might as well zoom into young Nifty's image to see what made up the top stuff.


* polyMenger3 bbb4.jpg (222.01 KB, 720x720 - viewed 122 times.)
Logged
DarkBeam
Global Moderator
Fractal Senior
******
Posts: 2512


Fragments of the fractal -like the tip of it


« Reply #23 on: December 15, 2016, 09:35:10 AM »

Whut? Is it still continuous? Or you have sliced it like sushi hurt
Logged

No sweat, guardian of wisdom!
mclarekin
Fractal Senior
******
Posts: 1738



« Reply #24 on: December 15, 2016, 09:54:56 AM »

Discontinuous  sad


* polyMenger3 bbb4a.jpg (188.78 KB, 800x800 - viewed 118 times.)
Logged
DarkBeam
Global Moderator
Fractal Senior
******
Posts: 2512


Fragments of the fractal -like the tip of it


« Reply #25 on: December 15, 2016, 10:05:17 AM »

The best try is just using Polyfold_sym as it is.
On even fold count discontinue on one half plane (not very visible). Else perfectly continue.
I remember the trick was to check the parity of the integer obtained from atan(). Change sign of y accordingly.
And probably in case of even folds.... do abs(y) on the sector n░zero. Not tested wink might be wrong
Logged

No sweat, guardian of wisdom!
mclarekin
Fractal Senior
******
Posts: 1738



« Reply #26 on: December 15, 2016, 10:14:52 AM »

I made it continuous   smiley

I will look to M3D soon, but am having fun mucking about with something I havent quite figured out yet.

BTW I am currently distracted by your Smooth Menger afro


* polyMenger3 bbb4b.jpg (189.18 KB, 800x800 - viewed 127 times.)
Logged
DarkBeam
Global Moderator
Fractal Senior
******
Posts: 2512


Fragments of the fractal -like the tip of it


« Reply #27 on: December 15, 2016, 10:17:07 AM »

Code:
void Poly_Fold_sym(inout dvec4 p, int order)
{
   float m = (float)order/TWOPI;
   bool cy = false; // lol... not glsl anymore

   int sector = (int)(m*(-atan(float(p.x),float(p.y))));
   if (sector&1) cy= true; // parity
   float angle = (float)sector/m;
   p.xy=rotate(p.xy,angle);
   if (cy) p.y=-p.y;
   // if ((order&1) && (sector ==0)) p.y = fabs(p.y); // more continuous?
}

To be tried wink
Logged

No sweat, guardian of wisdom!
AtomicNixon
Forums Newbie
*
Posts: 5


« Reply #28 on: August 09, 2017, 06:35:44 PM »

Quick question.... I'm looking to port some formulas from Mandelbulber into Fragmentarium and I ran across this...
z = Matrix33MulFloat3(consts->fractal.mandelbox.mainRot, z);

So I looked in the .h libraries from the latest build and um.....  Looking at that I know that I must have looked at the Fragmentarium equivalent and not had a clue.  These algos are so damn frustrating!  They're so short and compact, it doesn't look like they're able to do anything at all, and yet... Oh, first week out?  How did you guess!  Oh I'll wrap my head around it, no worries, but in the meanwhile I could use a pointer or two and maybe a point towards some required reading?

My first real target is to get that _polyfold_sym function slapped on top of a Kaliboxmod set so I can render these beasties at GPU rendering speed. 
<a href="https://www.youtube.com/v/d2dmPDA2Xbo&rel=1&fs=1&hd=1" target="_blank">https://www.youtube.com/v/d2dmPDA2Xbo&rel=1&fs=1&hd=1</a>

Logged
mclarekin
Fractal Senior
******
Posts: 1738



« Reply #29 on: August 10, 2017, 03:32:01 AM »

Hi AtomicNixon

I had forgotten I was supposed to be working on the polyfolds stuff  embarrass  Darkbeam optimistically suggested it would take me 6 months, lol.


a)   the z = matrix etc  http://www.fractalforums.com/index.php?topic=24826.msg98735#msg98735

try this

vect3 tp =
 
Code:
if (angleXY != 0)
{
tp = z;
z.x = tp.x * cos(angleXY) + tp.y * sin(angleXY);
z.y = tp.x * -sin(angleXY) + tp.y * cos(angleXY);
}
if (angleYZ != 0)
{
tp = z;
z.y = tp.y * cos(angleYZ) + tp.z * sin(angleYZ);
z.z = tp.y * -sin(angleYZ) + tp.z * cos(angleYZ);
}
if (angleXZ != 0)
{
tp = z;
z.x = tp.x * cos(angleXZ) + tp.z * sin(angleXZ);
z.z = tp.x * -sin(angleXZ) + tp.z * cos(angleXZ);
}

b) required reading,  Almost everything I have learnt has come  the advice given ,and code posted, at this forums. But for specific information it is often easier to ask then try and find it amongst this large archive of knowledge.


c) Mandelbulber V2.12 alpha is GPU powered,  most if not all of Mandelbulber V2.11 formulas work .  https://github.com/buddhi1980/mandelbulber2/releases

Any  testing of this alpha version by others is appreciated

Logged
Pages: 1 [2] 3   Go Down
  Print  
 
Jump to:  

Related Topics
Subject Started by Replies Views Last post
Mandelbulber 0.94 Mandelbulber « 1 2 » Buddhi 15 4014 Last post October 24, 2010, 09:36:01 AM
by Buddhi
Mandelbulber 0.95 Mandelbulber Buddhi 6 1846 Last post November 06, 2010, 11:46:26 PM
by nameinuse2
Mandelbulber 0.96 Mandelbulber Buddhi 14 4022 Last post November 27, 2010, 01:12:36 PM
by jotero
Mandelbulber 0.97 Mandelbulber Buddhi 8 2554 Last post January 06, 2011, 08:07:00 PM
by fastrail
Mandelbulber 0.98 Mandelbulber Buddhi 9 3083 Last post March 05, 2011, 09:49:03 PM
by Buddhi

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.2 seconds with 28 queries. (Pretty URLs adds 0.016s, 2q)