News: Did you know ? you can use LaTex inside Postings on fractalforums.com!  Welcome, Guest. Please login or register. October 04, 2022, 11:58:47 AM 1 Hour 1 Day 1 Week 1 Month Forever 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:    Go Down       Author Topic: Crystal fractals: Barnsley / fish variations  (Read 2599 times) Description: Formulas for 2D Crystal fractals 0 Members and 1 Guest are viewing this topic.
tyebillion
Forums Newbie Posts: 6 « on: January 20, 2013, 06:17:42 PM »

Hi,
Back in the nineties I wrote a fractal generator program called Minifrac, written in Delphi which I never finished and never released.  The program was unremarkable except that it had two fractal variations (Crystal 1 and Crystal 2) that I found myself, and also a nice palette generator.  Below is the Pascal code for the two Crystal fractals for anyone who is interested.  For the Mandelbrot version the initial values are x = 0 and y = 0, with the point on the screen assigned to (a, b).  Whereas the Julia sets for these fractals have parameters (a, b) and the point on the screen assigned to (x, y).  For iterations that do not escape, I used the minimum of the norm squared (e.g. x*x + y*y) to colour the interior points.  Attached is a nice zoom of one of these fractals, sorry I forget which one it is, although I remember that it is a Mandelbrot.

Code:
{ CRYSTAL 1 - Barnsley fish variant }
c := 0;
d := 0;
nz2_min := LARGE;
nz2 := 0;
while (nz2 < nz2_max) and (iters < term_iters) do begin
e := x;
f := y;
if x >= 0 then begin
p := x*c - y*d - a;
y := y*c + x*d - b;
x := p;
end else begin
p := x*c - y*d + a;
y := y*c + x*d + b;
x := p;
end;
c := e;
d := f;
nz2 := sqr(x) + sqr(y);
if nz2 < nz2_min then nz2_min := nz2;
inc(iters);
end;

{ CRYSTAL2 - Another sort of barnsley fish variant }
c := 0;
d := 0;
nz2_min := LARGE;
nz2 := 0;
while (nz2 < nz2_max) and (iters < term_iters) do begin
e := x;
f := y;
if x >= 0 then begin
p := x - c;
y := y - d;
x := a*p - b*y + 1;
y := a*y + b*p;
end else begin
p := x + c;
y := y + d;
x := a*p - b*y - 1;
y := a*y + b*p;
end;
c := e;
d := f;
nz2 := sqr(x) + sqr(y);
if nz2 < nz2_min then nz2_min := nz2;
inc(iters);
end; Logged
Alef
Fractal Supremo     Posts: 1174   « Reply #1 on: August 18, 2013, 06:55:04 PM »

Tested.
A first formula was kind of not worth to add to my formula file, but second crystal generated quite a nice Julias. Alsou added dual convergent and divergent bailout like of magnet what allows to see more outside patterns and some more variables for tweaking.
Didn't use any layering, as it is.    UF'll work after updating formulas

Code:
crystal4 {
fractal:
title="crystal4" width=640 height=480 layers=1
credits="Edgar;8/18/2013"
layer:
caption="Background" opacity=100
mapping:
center=0/0 magn=1.04
formula:
maxiter=140 percheck=off filename="em.ufm" entry="Crystalfractal"
p_bailout=10000000000 p_lowerbailout=9E-5 p_addval=1 p_settype=Julia
p_switchsettype=Mandelbrot p_julia=-0.7/0.225 f_func_post=abs
p_inverted=no p_fishstrenght=2 p_riselast=yes p_riselastpower=-1
inside:
transfer=none solid=4278190114
outside:
transfer=linear filename="em.ucl" entry="Pauldebrots_Smooth"
p_convergent=no p_esm=no p_alt=no p_perfix=1.0 p_zmax=100 p_power=2
p_fit=yes p_fittimes=1.0 p_fitminit=89 p_fitmaxit=140 p_transfer=Log
p_transpower=3.0 p_bailout=10000000000
smooth=yes rotation=68 index=52 color=0 index=126 color=16121855
index=263 color=0 index=389 color=33023
opacity:
smooth=yes index=82 opacity=255 index=220 opacity=255 index=315
opacity=255 index=358 opacity=255 index=377 opacity=255
} Logged

fractal catalisator
tyebillion
Forums Newbie Posts: 6 « Reply #2 on: August 19, 2013, 06:13:19 PM »

Good work, well done!  I like the images.  What program did you use?

Here is a tweak to try.  The cut off line x=0 could be rotated using a parameter.  Below is the code.  It could be interesting to animate a Julia set by changing this parameter t from 0 to 2*pi (radians).

Code:
{ CRYSTAL 1 - Barnsley fish variant }
c := 0;
d := 0;
u := cos(t);
v := sin(t);
nz2_min := LARGE;
nz2 := 0;
while (nz2 < nz2_max) and (iters < term_iters) do begin
e := x;
f := y;
if (x*u - y*v) >= 0 then begin
p := x*c - y*d - a;
y := y*c + x*d - b;
x := p;
end else begin
p := x*c - y*d + a;
y := y*c + x*d + b;
x := p;
end;
c := e;
d := f;
nz2 := sqr(x) + sqr(y);
if nz2 < nz2_min then nz2_min := nz2;
inc(iters);
end;

{ CRYSTAL2 - Another sort of barnsley fish variant }
c := 0;
d := 0;
u := cos(t);
v := sin(t);
nz2_min := LARGE;
nz2 := 0;
while (nz2 < nz2_max) and (iters < term_iters) do begin
e := x;
f := y;
if (x*u - y*v) >= 0 then begin
p := x - c;
y := y - d;
x := a*p - b*y + 1;
y := a*y + b*p;
end else begin
p := x + c;
y := y + d;
x := a*p - b*y - 1;
y := a*y + b*p;
end;
c := e;
d := f;
nz2 := sqr(x) + sqr(y);
if nz2 < nz2_min then nz2_min := nz2;
inc(iters);
end;
 « Last Edit: August 19, 2013, 09:56:10 PM by tyebillion » Logged
Alef
Fractal Supremo     Posts: 1174   « Reply #3 on: August 20, 2013, 04:47:55 PM »

Its a Ultra Fractal save file. But I alsou put it in Chaos Pro, what is a non comercial clone of UF.

@ is user changable parameters and flip generates imaginary value.
Code:
loop:

complex oldz =z

oldx=x
oldy=y

IF x >= 0
temp = x - olderx
y = y - oldery
x = cx*temp - cy*y + @addval
y = cx*y + cy*temp
ELSE
temp = x + olderx
y = y + oldery
x = cx*temp - cy*y - @addval
y = cx*y + cy*temp
ENDIF

olderx=oldx
oldery=oldy

z=x+flip(y)

IF  (@riselast)
z=z^@riselastpower
ENDIF

bailout:
|z| < @bailout && |z - oldz| > @lowerbailout Logged

fractal catalisator
tyebillion
Forums Newbie Posts: 6 « Reply #4 on: August 20, 2013, 08:47:17 PM »

Thanks for the info, good idea to turn the "1" into a parameter.
What do you think of trying the tweak I mentioned?

I would like to try my formula in Ultra Fractal as my original program only does 640x400 pixels.

I found an interesting zoom on the Crystal2 Mandelbrot, around x=-0.726282702589718, y=-0.349032801550238.  It looks like "flags" or "fish bones".  By the way I used a "bailout" of 10 (= x^2 + y^2), I think that would be equivalent to 100 in your code, but I am not sure.  Anyway I included a picture of the Crystal2 Mandelbrot below.

I couldn't find the location of the "atoms" in my first picture, I never wrote down the co-ordinates.
 « Last Edit: August 20, 2013, 09:07:04 PM by tyebillion » Logged
tyebillion
Forums Newbie Posts: 6 « Reply #5 on: August 27, 2013, 03:36:30 PM »

I tried my formula in Ultra Fractal.  Here is the code I used:

Code:
Crystal2b {
init:
if (@mset == 0)
c = #pixel
z = 0
else
c = @juliac
z = #pixel
endif
z1 = 0
u = cos(@theta)
v = sin(@theta)
loop:
z2 = z

if (real(z)*u - imag(z)*v >= 0)
z = z - z1
z = z*c + @alpha
else
z = z + z1
z = z*c - @alpha
endif

z1 = z2

bailout:
|z| < @bailout
} Logged
 Pages:    Go Down
 Related Topics Subject Started by Replies Views Last post  Julia Variations I Images Showcase (Rate My Fractal) _db_ 4 1289 August 31, 2013, 06:56:00 PM by Nahee_Enterprises   Variations VI 2d Art _db_ 0 2580 May 29, 2011, 02:37:39 AM by _db_  Variations Images Showcase (Rate My Fractal) _db_ 2 1066 May 31, 2011, 01:03:34 AM by _db_  2D Mandelbox variations Amazing Box, Amazing Surf and variations Kali 9 2428 July 16, 2011, 06:11:02 PM by eiffie  Variations on a theme Images Showcase (Rate My Fractal) thom 0 487 November 29, 2011, 02:36:17 AM by thom