public JuliaEditor(Julia BaseJulia)
 {
     InitializeComponent();
     numericUpDown1.Maximum = (decimal)ulong.MaxValue;
     numericUpDown1.Value = 10000M;
     numericUpDown1.Minimum = 1M;
     if (BaseJulia == null) return;
     numericUpDown1.Value = BaseJulia.Iterations;
     LeftEdge = BaseJulia.LeftEdge;
     RightEdge = BaseJulia.RightEdge;
     TopEdge = BaseJulia.TopEdge;
     BottomEdge = BaseJulia.BottomEdge;
     RealPart = BaseJulia.ComplexConst.Real;
     ImaginePart = BaseJulia.ComplexConst.Imagine;
     CreateButton.Select();
 }
Esempio n. 2
0
        private void Draw()
        {
            performanceLogger.Start(Settings.selectedFractalType, Settings.selectedDrawingMode);

            Fractal fractal = null;

            switch (Settings.selectedFractalType)
            {
            case FractalType.Mandelbrot:
                fractal = new Mandelbrot(colorBuffer, Settings.renderWidth, Settings.renderHeight, Settings.maxIterations);
                break;

            case FractalType.Julia:
                fractal = new Julia(colorBuffer, Settings.renderWidth, Settings.renderHeight, Settings.maxIterations);
                break;

            default:
                throw new Exception("Nieprawidłowy typ fraktala: " + Settings.selectedFractalType);
            }

            switch (Settings.selectedDrawingMode)
            {
            case DrawingMode.CpuSingle:
                fractal.DrawOnSingleThread(offsetX, offsetY, zoom);
                break;

            case DrawingMode.CpuMulti:
                fractal.DrawOnMultipleThreads(offsetX, offsetY, zoom);
                break;

            case DrawingMode.Gpu:
                fractal.DrawOnGpu(offsetX, offsetY, zoom);
                break;

            default:
                throw new Exception("Nieprawidłowy typ rysowania: " + Settings.selectedDrawingMode);
            }

            performanceLogger.Stop(CountTotalIterations());

            UpdateBitmap();
            UpdateTransformationText();
        }
Esempio n. 3
0
    private void Awake()
    {
        if (Instance == null)
        {
            Instance = this;
        }
        else
        {
            Debug.LogError("Double instantiation : " + this);
            Destroy(gameObject);
            return;
        }

        julia            = GetComponentInChildren <Julia>();
        juliett          = GetComponentInChildren <Juliett>();
        physicalCollider = GetComponent <BoxCollider2D>();
        controller       = GetComponent <Controller2D>();
        soundEffects     = GetComponent <PlayerSoundEffects>();

        currentHealth = MaxHealth;
    }
Esempio n. 4
0
        public void JuliaFractalTest()
        {
            byte[] a = new byte[400 * 300 * 4];
            byte[] b = new byte[400 * 300 * 4];
            byte[] c = new byte[400 * 300 * 4];

            Utils.BuildIterationColorsCache();

            Julia juliaFractal_A = new Julia(a, 400, 300, 60);

            juliaFractal_A.DrawOnSingleThread(0, 0, 1);

            Julia juliaFractal_B = new Julia(b, 400, 300, 60);

            juliaFractal_B.DrawOnMultipleThreads(0, 0, 1);

            CollectionAssert.AreEqual(a, b);

            Julia juliaFractal_C = new Julia(c, 400, 300, 60);

            juliaFractal_C.DrawOnGpu(0, 0, 1);

            CollectionAssert.AreEqual(a, c);
        }
Esempio n. 5
0
        public Form1()
        {
            InitializeComponent();

            #region Fractal classes constructors
            HarterDragon    = new Harter_Dragon();
            MinkovskySquare = new Minkovsky_Square();
            SquareCutted    = new Square_Hole();
            KochCurve       = new Koch_Curve();
            SerpinskyCarpet = new Serpinsky_Carpet();
            Fern            = new ISF_Fern();
            Cobweb          = new ISF_Cobweb();
            Dragon          = new ISF_Dragon();
            Star            = new ISF_Star();
            Spiral          = new ISF_Spiral();
            WindFern        = new ISF_WindFern();

            JuliaSet = new Julia();
            ManSet   = new Mandelbrot();
            #endregion


            #region Image Processing init
            Gray                   = new Grayscale();
            BlurPicture            = new Blur();
            Border                 = new Borders();
            openFileDialog1        = new OpenFileDialog();
            openFileDialog1.Filter = "Images (*.bmp;*.jpg;*.gif)|*.bmp;*.jpg;*.gif|All files(*.*)|*.*";
            loadf                  = false;
            #endregion


            #region Fractal variables init
            loaded        = false;
            depth_counter = 0;
            iterations    = 1000;

            jmiterations = 100;
            rec          = 0.11;
            imc          = -0.66;

            minx = -1.5; maxx = 1.5;
            miny = -1.5; maxy = 1.5;

            s_fractal  = false;
            i_fractal  = false;
            j_fractal  = false;
            m_fractal  = false;
            w_fractal  = false;
            w2_fractal = false;

            details = 800;
            scale   = 1;
            #endregion


            #region Vector Fields init
            Surface = new Grid();

            openFileDialog2        = new OpenFileDialog();
            openFileDialog2.Filter = "(*.txt; *.res)|*.txt;*.res|All files(*.*)|*.*";
            drawv = false;


            y_offset = 0;
            z_offset = 0;

            x_rotated = 0;
            y_rotated = 0;

            constant  = 1;
            timevalue = 0;
            LightONF  = true;
            InvNorm   = false;
            #endregion


            Fractal_GL_window.InitializeContexts();
            VectorFields.InitializeContexts();
        }
Esempio n. 6
0
        private void DrawJulia()
        {
            Julia fr = new Julia(Domain);

            fr.Draw(img, Jp, Jq);
        }
Esempio n. 7
0
        static void Main(string[] args)
        {
            Console.WriteLine(string.Join(" ", args));
            Console.WriteLine("Environment Version: {0}", Environment.Version.ToString());

            Fractal fractal = new Fractal();

            foreach (string a in args)
            {
                switch (a)
                {
                case "animate":
                    int upper = 900;
                    for (int i = 0; i < upper; i++)
                    {
                        double zoom = Helper.Map(i, 0, upper, 1, 5);
                        //centered on (-0.54,0.0)
                        //fractal = new Glynn(W, H, i,0,0).Init(-0.79 + zoom, -0.29 - zoom, -0.25 + zoom, 0.25 - zoom);//focuses on the top tree
                        //fractal = new Glynn(W, H, HIGHEST, zoom, 1).Init(-0.8, 1.4, -1.2, 1.2);//focuses on all the trees
                        double x0 = Helper.Map(i, 0, upper, -2, 1.225);
                        double x1 = Helper.Map(i, 0, upper, 2, 1.325);
                        double y0 = Helper.Map(i, 0, upper, -2, -0.05);
                        double y1 = Helper.Map(i, 0, upper, 2, 0.05);

                        fractal = new Glynn(W, H, HIGHEST, zoom, 1).Init(x0, x1, y0, y1);
                        fractal.Render().DistanceMapped();
                        //DistanceHSV();
                        fractal.SaveImage(i.ToString("D5"));
                    }
                    break;

                case "buddhabrot":
                    fractal = new Buddhabrot(W, H, 0, 1000, HIGHEST)
                              //.Init(-2, 2, -2, 2);
                              .Init(-1.9, 1.9, -2.1, 1.7);
                    break;

                case "glynn":
                    fractal = new Glynn(W, H, HIGHEST, 0, 0)
                              //.Init(0.066, 0.42, -0.6677, -0.323);
                              .Init(1, -1, -1, 1);
                    //.InitPoint(-0.539, 0, 0.2, 0.2);//r, i, width, height
                    break;

                case "julia":
                    fractal = new Julia(W, H, HIGHEST)
                              //.Init(-0.39, -0.7, 0.19, -0.12);
                              .Init(-0.8, 0.8, -0.8, 0.8);
                    break;

                case "load":
                    fractal.LoadSettings("settings.json").LoadDistance("distance.dat").LoadExposure("exposure.dat");
                    break;

                case "logisticmap":
                    fractal = new LogisticMap(W, H, HIGHEST)
                              .Init(0, 0, 0, 0);
                    break;

                case "mandelbrot":
                    fractal = new Mandelbrot(W, H, 3000, HIGHEST).Init(-1, 1, -1, 1);
                    break;

                case "render":
                    fractal.Render();
                    break;

                case "shade":
                    fractal.
                    //DistanceBinned();
                    //DistanceHSV();
                    //DistanceMapped();
                    //Exponential(2);
                    //ExposureBinned();
                    //ExposureHSV();
                    //HexColor();
                    LogBaseHighest();
                    //Mapped();
                    //SmoothStep();
                    break;

                case "save":
                    fractal.SaveSettings("settings.json").SaveDistance("distance.dat").SaveExposure("exposure.dat");
                    break;

                case "draw":
                    fractal.Draw();
                    break;

                case "/?":
                    Console.WriteLine(String.Format("{0,5}", "Options:"));
                    Console.WriteLine(String.Format("{0,-10} {1,-40}", "/?", "Display this help message"));
                    Console.WriteLine(String.Format("{0,-10} {1,-40}", "buddhabrot", "Renders a fractal based on the Buddhabrot set"));
                    Console.WriteLine(String.Format("{0,-10} {1,-40}", "glynn", "Renders a fractal based on the Glynn Set"));
                    Console.WriteLine(String.Format("{0,-10} {1,-40}", "julia", "Renders a fractal based on the Julia Set"));
                    Console.WriteLine(String.Format("{0,-10} {1,-40}", "mandelbrot", "Renders a fractal based on the Mandelbrot Set"));
                    break;
                }
            }
        }
Esempio n. 8
0
 public void RunJuliaScript()
 {
     Julia.Run();
 }