Kalles Fraktaler
|
|
« on: January 27, 2017, 10:41:57 AM » |
|
Inflection mappingshttp://www.fractalforums.com/index.php?action=gallery;sa=view;id=19987Morphing 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
|
|
|
|
superheal
|
|
« 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
|
|
« 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
|
|
|
|
Dinkydau
|
|
« Reply #3 on: January 27, 2017, 07:50:22 PM » |
|
Nice. Is this a new feature in Kalles Fraktaler?
|
|
|
Logged
|
|
|
|
gds-entropy
|
|
« 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
|
|
« 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
|
|
|
|
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: 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: 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
|
|
« 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: // 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
|
|
|
|
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
|
|
« 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
|
|
|
Logged
|
|
|
|
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: #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
|
|
|
|
Adam Majewski
|
|
« 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
|
|
|
|
|