News: Check out the originating "3d Mandelbulb" thread here

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

 Pages: [1]   Go Down
 Author Topic: Inflection mappings  (Read 3110 times) Description: 0 Members and 1 Guest are viewing this topic.
Kalles Fraktaler
Fractal Senior

Posts: 1458

 « on: January 27, 2017, 10:41:57 AM »

Inflection mappings

http://www.fractalforums.com/index.php?action=gallery;sa=view;id=19987

Morphing a basic Mandelbrot-shape 30 times, which would require a zoom depth of E1406173.
But this image is actually out-zoomed, calculated with plain double datatypes.
Points are transformed according to this:

// Get the points in the mandelbrot for the screen coordinates
r = r_start+x*(r_stop-r_start)/nX;
i = i_start+y*(i_stop-i_start)/nY;

// Transform the coordinates for each inflection point
int inf;
for(inf=g_nInflections-1;inf>=0;inf--){
if(r>g_pInflections[inf].r){
r = g_pInflections[inf].r - (r-g_pInflections[inf].r);
i = g_pInflections[inf].i - (i-g_pInflections[inf].i);
}
double ratio = (double)(i-g_pInflections[inf].i)/(double)(r-g_pInflections[inf].r);
double degree = -atan(ratio);
double dist = sqrt((double)((r-g_pInflections[inf].r)*(r-g_pInflections[inf].r)+(i-g_pInflections[inf].i)*(i-g_pInflections[inf].i)))/diagonal;
double dr = (double)g_pInflections[inf].r + (double)(r-g_pInflections[inf].r)*cos(degree)*dist
+ (double)(i-g_pInflections[inf].i)*sin(degree)*dist;
double di = (double)g_pInflections[inf].i + (double)(i-g_pInflections[inf].i)*cos(degree)*dist
- (double)(r-g_pInflections[inf].r)*sin(degree)*dist;
r=dr;
i=di;
}

// Contiunue with the ordinary mandelbrot calculation sequence
 « Last Edit: January 27, 2017, 01:50:31 PM by Kalles Fraktaler » Logged

Want to create DEEP Mandelbrot fractals 100 times faster than the commercial programs, for FREE? One hour or one minute? Three months or one day? Try Kalles Fraktaler http://www.chillheimer.de/kallesfraktaler
superheal
Alien

Posts: 24

 « Reply #1 on: January 27, 2017, 10:54:49 AM »

Can you share the contents of the infections array, or how you generate it?
 Logged
Kalles Fraktaler
Fractal Senior

Posts: 1458

 « Reply #2 on: January 27, 2017, 12:59:58 PM »

I select the points in the inflection array by clicking in the image, the points which I want the pattern to be wrapped around
 Logged

Want to create DEEP Mandelbrot fractals 100 times faster than the commercial programs, for FREE? One hour or one minute? Three months or one day? Try Kalles Fraktaler http://www.chillheimer.de/kallesfraktaler
Dinkydau
Fractal Senior

Posts: 1616

 « Reply #3 on: January 27, 2017, 07:50:22 PM »

Nice. Is this a new feature in Kalles Fraktaler?
 Logged

gds-entropy
Alien

Posts: 29

 « Reply #4 on: January 27, 2017, 10:24:59 PM »

Looks quite nice.

This is very similar to the "Origami Butterfly" technique used by Jonatan McCabe, but with a different source of data for reflection/folding. There is some Processing code out there which mimics this.

Ian
 Logged
Kalles Fraktaler
Fractal Senior

Posts: 1458

 « Reply #5 on: January 31, 2017, 10:50:01 PM »

Nice. Is this a new feature in Kalles Fraktaler?
No sorry, I am just playing with a program using plain double datatype
 Logged

Want to create DEEP Mandelbrot fractals 100 times faster than the commercial programs, for FREE? One hour or one minute? Three months or one day? Try Kalles Fraktaler http://www.chillheimer.de/kallesfraktaler
claude
Fractal Bachius

Posts: 563

 « Reply #6 on: February 02, 2017, 12:14:07 AM »

I think your code can be simplified and optimized using properties of right-angled triangles:

Code:
dist = sqrt(dx * dx + dy * dy)
ratio = dy / dx
angle = atan(ratio)

cos(angle) = adjacent / hypotenuse = dx / sqrt(dx * dx + dy * dy)
sin(angle) = opposite / hypotenuse = dy / sqrt(dx * dx + dy * dy)

cos(angle) * dist = dx
sin(angle) * dist = dy

There may be some sign errors, and I ignored your 'diagonal' variable not knowing what it does, but nothing that can't be solved cheaply afaict.

EDIT then it can be simplified further using properties of complex numbers:

Code:
double _Complex inflectionmapping(int n, double _Complex *cs, double _Complex c)
{
for (int i = 0; i < n; ++i)
{
double _Complex d = c - cs[i];
c = cs[i] + d * d;
}
return c;
}

I haven't tested this yet, but I'm fairly confident that it's this simple!
 « Last Edit: February 02, 2017, 12:35:31 AM by claude, Reason: typo » Logged
Kalles Fraktaler
Fractal Senior

Posts: 1458

 « Reply #7 on: February 02, 2017, 09:34:07 AM »

Awesome claude, that's magic!
Yes it works

And your code get rid of sqrt, cos, sin, tan and also the arbitrary constant "diagonal" which was simply the size of the diagonal of the window.

If you want to test it, please note that you probably need to reverse the order of applying the inflection points.

So this is the new simplified code:
Code:
// Map the screen pixels to points in the fractal
r = r_start+x*(r_stop-r_start)/nX;
i = i_start+y*(i_stop-i_start)/nY;
int inf;
std::complex<double> c(r,i);
for(inf=g_nInflections-1;inf>=0;inf--){
std::complex<double> cs(g_pInflections[inf].r,g_pInflections[inf].i);
std::complex<double> d = c-cs;
c=cs+d*d;
}
r=c.real();
i=c.imag();
// Proceed with the fractal sequence
 Logged

Want to create DEEP Mandelbrot fractals 100 times faster than the commercial programs, for FREE? One hour or one minute? Three months or one day? Try Kalles Fraktaler http://www.chillheimer.de/kallesfraktaler
hobold
Fractal Bachius

Posts: 573

 « Reply #8 on: February 05, 2017, 02:18:57 PM »

These inflections are kinda nice even without an underlying fractal formula:

Here I used 1/z of a checkerboarded complex plane as the underlying pattern. Then three different inflections. Each inflection doubles the number of "flowers" (really the pole of 1/z), so there are eight in total.
 Logged
Kalles Fraktaler
Fractal Senior

Posts: 1458

 « Reply #9 on: February 06, 2017, 12:19:01 AM »

These inflections are kinda nice even without an underlying fractal formula:
...image...
Here I used 1/z of a checkerboarded complex plane as the underlying pattern. Then three different inflections. Each inflection doubles the number of "flowers" (really the pole of 1/z), so there are eight in total.
Cool!
I tried myself with photo images, however close around the inflection point the pattern is magnified a lot, and if the image is not very large (large AA) the pixels get quite visible
 atlantis.jpg (233.86 KB, 922x541 - viewed 309 times.) Logged

Want to create DEEP Mandelbrot fractals 100 times faster than the commercial programs, for FREE? One hour or one minute? Three months or one day? Try Kalles Fraktaler http://www.chillheimer.de/kallesfraktaler
claude
Fractal Bachius

Posts: 563

 « Reply #10 on: February 11, 2017, 12:50:29 AM »

There are two ways to do inflection mapping, one with Mandelbrot iterations (inflect C, start iterating at Z = 0), and another with Julia iterations (inflect Z, iterate with C set to the first inflection point (last to be applied)).

Here's a Mandelbrot version in Fragmentarium:

http://www.fractalforums.com/images-showcase-%28rate-my-fractal%29/fruity-%28inflection-mapping%29/

Here's a Julia version in Fragmentarium:

Code:
#include "Progressive2D.frag"

vec2 cMul(vec2 a, vec2 b)
{
return vec2(a.x * b.x - a.y * b.y, a.x * b.y + a.y * b.x);
}

vec2 cSqr(vec2 a)
{
return cMul(a, a);
}

vec4 cMul(vec4 a, vec4 b)
{
return vec4(cMul(a.xy, b.xy), cMul(a.xy, b.zw) + cMul(a.zw, b.xy));
}

vec4 cSqr(vec4 a)
{
return cMul(a, a);
}

#define N 6
const vec2 cs[N] = vec2[N]
( vec2(-0.75, 0.1)
, vec2(-0.7780062, 0.9591821)
, vec2(-0.7186571, 1.0251421)
, vec2(-0.5475953, 0.6401844)
, vec2(-0.5129835, 0.6237739)
, vec2(-0.4531227, 0.8943247)
);

vec3 color(vec2 c0)
{
float px = length(vec4(dFdx(c0), dFdy(c0)));
vec4 c = vec4(c0, px, 0.0);
for (int i = N-1; i >= 0; --i)
{
vec4 f = vec4(cs[i], 0.0, 0.0);
vec4 d = c - f;
c = cSqr(d) + f;
}
int n = 0;
vec4 z = c;
for (n = 0; n < 1000; ++n)
{
if (dot(z.xy, z.xy) >= 1.0e10)
break;
z = cSqr(z) + vec4(cs[0], 0.0, 0.0);
}
if (dot(z.xy, z.xy) < 1.0e10)
return vec3(1.0, 0.0, 0.0);
float r = length(z.xy);
float dr = length(z.zw);
float de = 2.0 * r * log(r) / dr;
float g = tanh(clamp(de, 0.0, 4.0));
if (isnan(de) || isinf(de) || isnan(g) || isinf(g))
g = 1.0;
return vec3(g);
}

Image of the Julia version:
 Logged
hapf
Fractal Lover

Posts: 219

 « Reply #11 on: May 16, 2017, 11:46:06 AM »

Where exactly is the region of the first posting? And was it retested with the simplified algorithm and looked the same as before?
 Logged
Fractal Lover

Posts: 221

 « Reply #12 on: May 16, 2017, 05:31:33 PM »

These inflections are kinda nice even without an underlying fractal formula:
<Quoted Image Removed>
Here I used 1/z of a checkerboarded complex plane as the underlying pattern. Then three different inflections. Each inflection doubles the number of "flowers" (really the pole of 1/z), so there are eight in total.

Great image
Can you post the code ?
can you upload it to commons ?

 Logged
hapf
Fractal Lover

Posts: 219

 « Reply #13 on: July 27, 2017, 12:10:01 PM »

The scaling can not be done away with in the fast algorithm. In the general case scaling is needed.
 Logged
 Pages: [1]   Go Down