Logo by bib - Contribute your own Logo!

END OF AN ERA, FRACTALFORUMS.COM IS CONTINUED ON FRACTALFORUMS.ORG

it was a great time but no longer maintainable by c.Kleinhuis contact him for any data retrieval,
thanks and see you perhaps in 10 years again

this forum will stay online for reference
News: Check out the originating "3d Mandelbulb" thread here
 
*
Welcome, Guest. Please login or register. April 16, 2024, 03:58:01 PM


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: Little help needed for extending the Kleinian algo.  (Read 5913 times)
0 Members and 1 Guest are viewing this topic.
DarkBeam
Global Moderator
Fractal Senior
******
Posts: 2512


Fragments of the fractal -like the tip of it


« on: January 06, 2017, 11:28:02 PM »

Hi all.
The algorithm by Jos is fantastic. The problem is that for some reason the spatial vars x y z during iters get more and more discontinue except y (?) ...
I do not understand a lot of operations that are in the code. So it is very hard to figure out modifications without ruining the good DE.

The easiest is Aexion's. Add something to z also instead only to y and x before inversion.
http://www.fractalforums.com/index.php?topic=24728.msg98467#msg98467
Gives cool results.
The problem is that the DE gets instantly broken (even for infinitesimal values).
Even the separation line seems to not work anymore.
Ideas on how to fix?
« Last Edit: January 06, 2017, 11:35:11 PM by DarkBeam » Logged

No sweat, guardian of wisdom!
pupukuusikko
Alien
***
Posts: 35


WWW
« Reply #1 on: January 06, 2017, 11:52:52 PM »

There is a line in the frag:
z = vec3(-b, a, 0.) - z;

In Aexion's version, I think it should be:
z = vec3(-b, a, -KleinJ) - z;

at least then it doesn't turn to dust so easily smiley
Logged

DarkBeam
Global Moderator
Fractal Senior
******
Posts: 2512


Fragments of the fractal -like the tip of it


« Reply #2 on: January 07, 2017, 12:24:13 AM »

I will test this asap! Thanks so much my friend!
Logged

No sweat, guardian of wisdom!
JosLeys
Strange Attractor
***
Posts: 258


WWW
« Reply #3 on: January 07, 2017, 11:41:25 AM »

Wait, it is a bit more complicated than that.
Adding in the KleinJ parameter in the z-direction requires the 'separation line' to be rotated.
The 'line' is actually a plane perpendicular to the xy plane.
Just try it: put KleinI=0 and KleinJ=something and things go horribly wrong.

The equation for the separation line :  a * (0.5 +  f * 0.25 * sign(z.x + b * 0.5)* (1. - exp( - 3.2 * abs(z.x + b * 0.5))))) needs changing.
Let c=KleinJ.

Let d=(b*(z.x+b*0.5)-c*(z.z+c*0.5))/sqrt(b*b+c*c)

Then we need :  a * (0.5 +  f * 0.25 * sign(d)* (1. - exp( - 3.2 * abs(d)))))

I have not tried it out on the frag code, so beware of mistakes!
.   
« Last Edit: January 07, 2017, 12:15:50 PM by JosLeys » Logged
DarkBeam
Global Moderator
Fractal Senior
******
Posts: 2512


Fragments of the fractal -like the tip of it


« Reply #4 on: January 07, 2017, 12:36:41 PM »

It REALLY works perfectly thanks so much guys!!!
Sponge Bob looney drinking beer together
Logged

No sweat, guardian of wisdom!
JosLeys
Strange Attractor
***
Posts: 258


WWW
« Reply #5 on: January 07, 2017, 12:56:52 PM »

Just one thing, with the changed equation for the separation line, things will fail if both KleinI and KleinJ are zero.
(division by zero)
Logged
JosLeys
Strange Attractor
***
Posts: 258


WWW
« Reply #6 on: January 07, 2017, 02:35:28 PM »

...and another thing.: I tried it out in my UF implementation and have some corrections.
I said:
Quote
Let c=KleinJ.
Let d=(b*(z.x+b*0.5)-c*(z.z+c*0.5))/sqrt(b*b+c*c)
Then we need :  a * (0.5 +  f * 0.25 * sign(d)* (1. - exp( - 3.2 * abs(d)))))

This should be:
first :
if c=0
  {float f=1,if b<0,f=-1}

if b=0
  {float f=1,if c<0,f=-1}

if abs(c)>0 && abs(b)>0,f=1

Then: Let d=(b*(z.x+b*0.5)+c*(z.z+c*0.5))/sqrt(b*b+c*c)
..and you could add
if (b=0 && c=0), d=z.x
Logged
DarkBeam
Global Moderator
Fractal Senior
******
Posts: 2512


Fragments of the fractal -like the tip of it


« Reply #7 on: January 07, 2017, 11:00:03 PM »

Jos ... can simply be
 f = sign (b*c)
?

I would also like to ask more complicated questions but I also asked to Knighty (I will wait)

Please people be patient a little the formula is under construction.
Meanwhile use positive b and Aexion...
wink
Logged

No sweat, guardian of wisdom!
JosLeys
Strange Attractor
***
Posts: 258


WWW
« Reply #8 on: January 07, 2017, 11:29:39 PM »

Quote
Jos ... can simply be
 f = sign (b*c)
?

I find that f should be 1 when both b and c are nonzero. If you do sign(b*c) you will still get -1 if b and c have opposite signs...
Logged
Aexion
Conqueror
*******
Posts: 116


The Fractal Hermit


WWW
« Reply #9 on: January 07, 2017, 11:31:09 PM »

Please people be patient a little the formula is under construction.
Meanwhile use positive b and Aexion...
wink

While the formula is under construction, you can either use a Julia Set mix for replacing the spheres or
use your favorite Abs() function for a set of very interesting variations
 grin

Logged

Fractals all the way..
Incendia for 3D Fractals
Aural for Musical Fractals
Sabine
Fractal Fertilizer
*****
Posts: 373



WWW
« Reply #10 on: January 08, 2017, 11:55:41 AM »

Aexion, such Beauties up here!  A Beer Cup
Logged

sabine62.deviantart.com
KRAFTWERK
Global Moderator
Fractal Senior
******
Posts: 1439


Virtual Surreality


WWW
« Reply #11 on: January 08, 2017, 02:40:33 PM »

Please people be patient a little the formula is under construction.
Meanwhile use positive b and Aexion...
wink

Cant wait.... wink
And Aexion... Beautiful renders!!!
Logged

DarkBeam
Global Moderator
Fractal Senior
******
Posts: 2512


Fragments of the fractal -like the tip of it


« Reply #12 on: January 08, 2017, 05:17:59 PM »

Since you already keep in mind signs of a, c in my opinion f should just be 1 (you multiply by b then divide by a modulus -> equals to sgn(b) if c=0 etc. ... ) grin
, in my case 0.25 because I moves out some constants, so this should be the correct;
(sorry for the strange stuff all around but it just works into assembly! evil )

Code:
double x,y,z;
//vec3 lz=z+vec3(1.), llz=z+vec3(-1.);
double DF = load1();
x=loadX(); y=loadY(); z=loadZ();
double lzx = x+DF; double lzy = y+DF; double lzz = z+DF;
double llzx = x-DF; double llzy = y-DF; double llzz = z-DF;
double DE = loadNthDoubleCns(0,0);
double d2;
double oC = DE;
double a, b, AexJ;
//double bdiva = (fabs(b)>loadNthDoubleCns(1,0))?b/a:load1();
double bdiva, distJosfix;
double f; // f * 0.25
int Box_Iterations = loadNthIntVar(0,6*szof1dbl);
int Final_Iterations = loadNthIntVar(1,6*szof1dbl);
int MiscOps;
int SpI = (loadNthIntVar(2,6*szof1dbl))&4;
double bsx = loadNthDoubleVar(2,0);
double bsz = loadNthDoubleVar(3,0);
double bsx2 = bsx*loadNthDoubleCns(5,0);
double bsz2 = bsz*loadNthDoubleCns(5,0);
int i;

if (Box_Iterations>100) Box_Iterations = 100;
if (Final_Iterations>20) Final_Iterations = 20;

    //Box_Iterations = 30; Final_Iterations = 4;
    a = loadNthDoubleVar(0,0); b = loadNthDoubleVar(1,0);
    AexJ = loadNthDoubleVar(10,3*szof1int);
    bdiva = (b/a);
WORD oldcw=fegr_floor(); // wrap() works ok
// f = sig0p(b)*sig0p(AexJ)*loadNthDoubleCns(3,0); // f * 0.25
f = loadNthDoubleCns(3,0); // = 0.25
distJosfix = sqrt(b*b+AexJ*AexJ);
if (distJosfix>loadNthDoubleCns(1,0)) distJosfix = recip(distJosfix);

// vars:
// 0 = dbl a; 1 = dbl b; 2 = dbl box_size_x; 3 = dbl box_size_y;
// 4 = dbl clampY; 5 = dbl clampDF;
// 6+off(3int) = iCx 7+off(3int) = iCx 8+off(3int) = iCx
// 0+off(6dbl) = int Box_Iterations;
// 1+off(6dbl) = int Final_Iterations;
MiscOps = (loadNthIntVar(2,6*szof1dbl))&4;
    if (MiscOps) {
        //z=z-InvCenter;
        x = x - loadNthDoubleVar(6,3*szof1int);
        y = y - loadNthDoubleVar(7,3*szof1int);
        z = z - loadNthDoubleVar(8,3*szof1int);
double iR = loadNthDoubleVar(9,3*szof1int); iR *= iR;
d2 = length2(x,y,z);
iR = iR/d2;
x = x*iR + loadNthDoubleVar(6,3*szof1int);
        y = y*iR + loadNthDoubleVar(7,3*szof1int);
        z = z*iR + loadNthDoubleVar(8,3*szof1int);
    }
    
MiscOps = (loadNthIntVar(2,6*szof1dbl))&1;
for (i = 0; i < Box_Iterations ; i++)
{
//if(z.y<0. || z.y>a) break;

x += bdiva*y;
/*
if (FourGen)
z = wrap(z, vec3(2. * box_size_x, a, 2. * box_size_z), vec3(- box_size_x, 0., - box_size_z));
else
z.xz = wrap(z.xz, vec2(2. * box_size_x, 2. * box_size_z), vec2(- box_size_x, - box_size_z));
*/
if (MiscOps) {
wrap3D(&x,&y,&z,
bsx2,a, bsz2,
-bsx,loadzero(),-bsz);
} else {
wrap2D(&x,&z,
bsx2,bsz2,
-bsx,-bsz);
}
x -= bdiva*y;

//If above the separation line, rotate by 180° about (-b/2, a/2)
// if  (z.y >= a * (0.5 +  f * 0.25 * sign(z.x + b * 0.5)* (1. - exp( - 3.2 * abs(z.x + b * 0.5)))))
{
// Jos' rotated separation line for Aexion mod! THANKS JOS!
double x00 = (b * (x + b * loadNthDoubleCns(2,0))
-AexJ*(z + AexJ * loadNthDoubleCns(2,0))) * distJosfix;
// old separation line:
// double x00 = x + b * loadNthDoubleCns(2,0);
x00 = loadNthDoubleCns(2,0) +  f * sign(x00) *
(load1() - exp( loadNthDoubleCns(4,0) * fabs(x00) ) ) ;
if  (y >= a *x00 )
{
//z = vec3(-b, a, 0.) - z;
// x = -b - x; y = a - y; z = -z ;original
x = -b - x; y = a - y; z = AexJ-z; // Pupukuusikko mod THANKS
//z.xy = vec2(-b, a) - z.xy; // commented out in Jos orig src
}
}

//Apply transformation a (Orig)
// TransA(&x,&y,&z, &DF, a, b);
//Apply transformation a + add Aex to z
TransA_Aex(&x,&y,&z, &DF, a, b, AexJ);
/*
//For colouring
double oCn = fabs(fabs(y)-fabs(x)-fabs(z));
oC = min(oC, oCn);
*/


//If the iterated points enters a 2-cycle , bail out.
if ( length2(x-llzx,y-llzy,z-llzz) < loadNthDoubleCns(1,0) )
{
break;
}
//Store prévious iterates
llzx = lzx; llzy = lzy; llzz = lzz;
lzx = x; lzy = y; lzz = z;
}
bsx = loadNthDoubleVar(11,3*szof1int);
saveOTColor( (loadNthDoubleCns(6,0)-bsx)*lzy / ( bsx*sqrt((double)i)+loadNthDoubleCns(6,0)) );

bsx = loadNthDoubleVar(4,0); // clampy
bsz = loadNthDoubleVar(5,0); // clampdf
MiscOps = (loadNthIntVar(2,6*szof1dbl))&2;
MiscOps = (MiscOps != 0);
//WIP: Push the iterated point left or right depending on the sign of KleinI
i = 0;
// sorry for using GOTO but it just does its job perfectly here
do {
   if (MiscOps) donothing();
else y = min(y, a-y); // Show balls (Strongly reccomended! Really! :D )
DE=min(DE,min(y,bsx)/max(DF,bsz));
if (i>=Final_Iterations) break;
//Apply inv-transformation a (Orig)
// TransAInv(&x,&y,&z, &DF, a, b);
//Apply inv-transformation a + add Aex to z
TransAInv_Aex(&x,&y,&z, &DF, a, b, AexJ);
i++;
} while (1);

MiscOps = (loadNthIntVar(2,6*szof1dbl))&4;
    if (MiscOps) { // fixde finale sphereinv
        DE=DE*d2/(loadNthDoubleVar(9,3*szof1int)+sqrt(d2)*DE);
    }
    
fesetround(oldcw); // do this right before returning
saveDE (DE);
/*
cns; loadNthDoubleCns(n,0);

0 = 1e10
1 = 1e-5
2 = 0.5
3 = 0.25
4 = -3.2
5 = 2.
---------
*/

To Aexion post codeeeeeeeeeeee praying the wave
Logged

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


Fragments of the fractal -like the tip of it


« Reply #13 on: January 09, 2017, 09:59:12 AM »

In the meantime.
I wanted to reproduce something that rensembles those groups:

http://alessandrorosa.altervista.org/complex/listings/circles/display.php?f=experiments/maskit/experiments.maskit.01.02.txt
Logged

No sweat, guardian of wisdom!
JosLeys
Strange Attractor
***
Posts: 258


WWW
« Reply #14 on: January 09, 2017, 10:40:22 AM »

@Darkbeam. The new version works well!
A question though : option 3 does the normal thing, while option 4 does the sphere inversion, but what about option 0,1,2 ?
Logged
Pages: [1] 2 3   Go Down
  Print  
 
Jump to:  

Related Topics
Subject Started by Replies Views Last post
DE estimation - help needed Mandelbulb Implementation chaospro 3 1980 Last post April 19, 2010, 02:29:28 AM
by David Makin
help needed for introduction chaosTube - History cKleinhuis 4 1477 Last post January 24, 2013, 11:03:59 PM
by Madman
help needed Introduction to Fractals and Related Links logan 5 772 Last post April 30, 2014, 08:38:25 PM
by logan
Algo-Rythmic Heart Images Showcase (Rate My Fractal) LMarkoya 1 1104 Last post April 24, 2016, 10:06:18 PM
by 3dickulus
Algo-Rythmic HEart Animated Images Showcase (Rate My Fractal) LMarkoya 1 880 Last post April 30, 2016, 04:26:46 PM
by cKleinhuis

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