Welcome to Fractal Forums

Fractal Art => Images Showcase (Rate My Fractal) => Topic started by: yv3 on October 09, 2011, 12:04:15 AM




Title: No Title
Post by: yv3 on October 09, 2011, 12:04:15 AM
(http://yv3.bplaced.net/gallery/yFract/25922.jpg)

This is my personal approach to implement the Collatz conjecture into a mandelbrot fractal ;).

Code:
	
void yFractal::GetFractalColor64()
{
static double x, y, prev_x, prev_y;
static int n, i;

prev_x=m_CustomRange4;
prev_y=0.0;

for(n=0; n<m_Iterations; n++)
{
x=m_StartX + (prev_x*prev_x*1.0) - (prev_y*prev_y*1.0);
y=m_StartY + (prev_x*prev_y*2.0);

i=int(x*y);

if(i%2==0)
{
if(m_CustomRange2!=0.0)
{
x=x/m_CustomRange2;
y=y/m_CustomRange2;
}
}
else
{
x*=m_CustomRange3;
x+=m_CustomRange1;
y*=m_CustomRange3;
y+=m_CustomRange1;
}

if((x*x)+(y*y) < m_Magnitude )
{
prev_x=x;
prev_y=y;
}
else
{
m_C=int( float(n) * m_ColorPerIteration ); // Return color index from range 0 to (m_NumColors-1)
return;
}
}

m_C=0;
}

Made with yFract (http://yv3.bplaced.net/forum/index.php?topic=53.0).