Welcome to Fractal Forums

Community => Introduction to Fractals and Related Links => Topic started by: yv3 on August 23, 2010, 09:55:52 PM




Title: yFractalExplorer - A Tribute to Fractint, and a question
Post by: yv3 on August 23, 2010, 09:55:52 PM
Hello,

im new here. OK, first i explain the circumstances :).
Im a C++ Programmer since about 10 years, working for a small company in Germany. Making games was always my dream since ive played Amiga in my school time. So i started to make an uniqe ASCII Multiplayer game in my spare time. I began three times from scratch to finish the enigine that provides the rendering and user interface in nostalgic Text Mode. Its based on SDL and OpenGL, its fast and it works fine. I was stumbled about an article on Code Project, a guy rendered a simple mandelbrot in Windows Console Mode. I wanted tried it out with my engine and then my biggest (sub-)project began :). The Software i wrote, called yFractalExplorer is now nearly complete. It has also a Text User Interface like the old good Fractint, but provides an more intuitive Interface with some unique features. This is more like an Entertainment Application than a common Fractal Software. You don't need know any math. You relax and fly around mostly smoothly in realtime to an intresting place, modify the fractal with keypresses and modifiers and then explore the image in graphics mode with wonderful palettes and color cycling. There is no post processing, it is minimalistic.

There are still some things to do, like loading and saving parameters, a bar in rendering mode that shows the current palette for a short while, rendering to files and adding much more fractal types. I will keep you updated when it will be released in this and my own forum on yv3.bplaced.net. It is free Donationware.

If you are intrested plz give it a try and share your opinion and suggestions with me: http://yv3.bplaced.net/files/yFractalExplorer.exe
Check out this guy :) : http://yv3.bplaced.net/gallery/yFractalExplorer/yFractalExplorer_011.gif
Here are some Fractals that i discovered when i was developing the application: http://yv3.bplaced.net/gallery/yFractalExplorer/

But the reason i registered here was not to make advertisement, i wanted to ask you guys something ;) I have an ugly implemented rotation of the fractal because the rotation is always around the middle of the fractal. I am not bad programmer but i know only about math basics and some physics. I want that the viewport always rotates about the center of the screen, even if i change the position the rotation must still remain and then if i rotate again the rotation must be again around the center of the screen. The current code for the mandelbrot looks like this:

Code:
void yFractal::GetFractalColor4() 
{
static double cx, cy, x, y, prev_x, prev_y, x_tmp, y_tmp, cosrot, sinrot;
static int n;

if(m_Rotation==0.0) //Rotation off
{
cx=m_X1 + (double(m_X)*m_WidthFactor);
cy=m_Y1 + (double(m_Y)*m_HeightFactor);
}
else //Rotate
{
x_tmp=m_X1 + (double(m_X)*m_WidthFactor);
y_tmp=m_Y1 + (double(m_Y)*m_HeightFactor);

cosrot=cos(m_Rotation);
sinrot=sin(m_Rotation);

cx=(x_tmp * cosrot) - (y_tmp * sinrot);
cy=(y_tmp * cosrot) + (x_tmp * sinrot);
}

prev_x=0;
prev_y=0;

for(n=0; n<m_Iterations; n++)
{
x=cx + (prev_x*prev_x) - (prev_y*prev_y);
y=cy + (2.0 * prev_x * prev_y);

if( ((x*x)+(y*y)) < m_Magnitude )
{
prev_x=x;
prev_y=y;
}
else
{
m_C=int( float(n) * m_ColorPerIteration );
return;
}
}

m_C=0;
}

m_X and m_Y are global Variables for faster rendering, they are set before calling the function to obtain a color index of a specific screen position.

Must i use a rotation matrix? I've googled around but maybe because my english is not as good i couldn't find a solution for this problem. The formulas on Wikipedia are too long for me, i also have to have time to play around with my son :). So maybe you can provide me a simple solution for this problem. I would be appreciated.



Title: Re: yFractalExplorer - A Tribute to Fractint, and a question
Post by: Jesse on August 23, 2010, 11:38:33 PM
Hi and welcome,

The solution is that you rotate before adding the position, so the position stays unchanged.
That's all, these conversions are very counter intuitive, make all the opposite way then you would expect  :dink:


Title: Re: yFractalExplorer - A Tribute to Fractint, and a question
Post by: yv3 on August 25, 2010, 08:31:13 AM
Thank you Jesse,

i have analyzed my code, the rotation was already before the movement but there was another bug, the rotation point was always around the center of the fractal, not the center of the screen. I fixed that quickly. But after that i had to deal with another problem that cost me 3 hours to solve  :angry:. For instance when the fractal was rotated about 180 degrees, the movement in horizontal plane was mirror inverted. So i had to apply the rotation also on the "Movement factor". But now it works perfectly and everything is fine. thank you.

BTW @all: Sorry i placed this post in the wrong board, i was to quick and did not realised that there are other boards after the advertisement in the main page. This should not happen again. Damn beer  :snore: