Example #1
0
        static void Main(string[] args)
        {
            int which = 2;

            if (which == 0)
            {
                SettingsFileLoader loado = new SettingsFileLoader();
                loado.root = @"C:\Users\Pizzamine98\Desktop\genmandel\";
                loado.LoadSettingsFiles();
                loado.MakeJsons();
                PolyOp opp = new PolyOp();
                opp.set = loado.sets[0];
                opp.StartUp();
                Polynomial deriv = opp.DerivativeC(opp.set.poly);
                opp.cvalplug        = new Complex();
                opp.cvalplug.num    = new Decimal[2];
                opp.cvalplug.num[0] = Decimal.Parse("0.1");
                opp.cvalplug.num[1] = Decimal.Parse("0.1");
                opp.cvalplug.cpow   = 0;
                opp.debug0          = true;
                opp.PlugIn(0, opp.set.poly);
            }
            else if (which == 1)
            {
                SettingsFileLoader loado = new SettingsFileLoader();
                loado.root = @"C:\Users\Pizzamine98\Desktop\genmandel\";
                loado.LoadSettingsFiles();
                loado.MakeJsons();
                MPlot poo = new MPlot();
                poo.set = loado.sets[0];
                PlotExporter export = new PlotExporter();
                export.set = loado.sets[0];
                export.Setup(poo);
            }
            else if (which == 2)
            {
                SettingsFileLoader loado = new SettingsFileLoader();
                loado.root = @"C:\Users\Pizzamine98\Desktop\genmandel\";
                loado.LoadSettingsFiles();
                loado.MakeJsons();
                SimpleItterator simp    = new SimpleItterator();
                int             whichid = 3;
                int             cores   = loado.GetIndexForGivenIndex(whichid);
                simp.set = loado.sets[cores];
                PolyOp opp = new PolyOp();
                opp.set        = loado.sets[cores];
                simp.set.nzoom = 10;
                opp.StartUp();
                simp.opm     = opp;
                simp.zoomnum = 0;
                simp.h       = 1080;
                simp.w       = 1920;
                while (simp.zoomnum < simp.set.nzoom)
                {
                    simp.Setup();
                    simp.zoomnum++;
                }
            }
        }
        public void Setup()
        {
            watch  = new Stopwatch();
            watch2 = new Stopwatch();
            watch.Start();
            rando      = new System.Random();
            hasome     = false;
            nsteps     = set.nsteps;
            ncold      = h * w * 4;
            colz       = new byte[h, w, 4];
            zoomfactor = (Decimal)(Math.Pow((double)set.zoomfactoreach, zoomnum));
            if (zoomnum == 0)
            {
                lastplug     = new Complex();
                lastplug.num = new Decimal[2] {
                    Decimal.Zero, Decimal.Zero
                };
                lastplug.cpow = 0;
                starter       = new Decimal[2] {
                    set.boundingrec[0], set.boundingrec[1]
                };
                deltax = (set.boundingrec[2] - set.boundingrec[0]) / (Decimal)w;
                deltay = (set.boundingrec[3] - set.boundingrec[1]) / (Decimal)h;
                curpos = new Decimal[2] {
                    set.boundingrec[0], set.boundingrec[1]
                };
            }
            else
            {
                deltax  = (set.boundingrec[2] - set.boundingrec[0]) / (Decimal)(w * zoomfactor);
                deltay  = (set.boundingrec[3] - set.boundingrec[1]) / (Decimal)(h * zoomfactor);
                starter = new Decimal[2] {
                    lastplug.num[0] - (Decimal)(deltax * w / 2), lastplug.num[1] - (Decimal)(deltay * h / 2)
                };
                curpos = new Decimal[2] {
                    lastplug.num[0] - (Decimal)(deltax * w / 2), lastplug.num[1] - (Decimal)(deltay * h / 2)
                };
            }
            int hill = (int)(Math.Sqrt((h * h) + (w * w)));

            for (int ii = 0; ii < h; ii++)
            {
                watch2.Start();
                int stepnu = ii + 1;

                for (int jj = 0; jj < w; jj++)
                {
                    opm.cvalplug      = new Complex();
                    opm.cvalplug.cpow = 0;
                    opm.cvalplug.num  = new Decimal[2] {
                        curpos[0], curpos[1]
                    };


                    opm.PlugIn(0, opm.set.poly);
                    colz[ii, jj, 0] = 255;
                    colz[ii, jj, 1] = (byte)opm.col.rgb[0];
                    colz[ii, jj, 2] = (byte)opm.col.rgb[1];
                    colz[ii, jj, 3] = (byte)opm.col.rgb[2];
                    if (ii != 0 && jj != 0)
                    {
                        if (colz[ii, jj, 1] == 0 && colz[ii, jj, 2] == 0 && colz[ii, jj, 3] == 0)
                        {
                            if (colz[ii, jj - 1, 1] == 0 && colz[ii, jj - 1, 2] == 0 && colz[ii, jj - 1, 3] == 0)
                            {
                            }
                            else
                            {
                                if (!hasome)
                                {
                                    lastplug      = new Complex();
                                    lastplug.cpow = opm.cvalplug.cpow;
                                    hasome        = true;
                                    lastplug.num  = new Decimal[2] {
                                        curpos[0], curpos[1]
                                    };
                                }
                                else
                                {
                                    int mook = rando.Next(0, hill);

                                    if (mook == 0)
                                    {
                                        Console.WriteLine("GOT ONE");
                                        lastplug      = new Complex();
                                        lastplug.cpow = opm.cvalplug.cpow;
                                        lastplug.num  = new Decimal[2] {
                                            curpos[0], curpos[1]
                                        };
                                    }
                                }
                            }
                        }
                    }
                    curpos[0] += deltax;
                }
                curpos[0]  = starter[0];
                curpos[1] += deltay;
                watch2.Stop();
                dtper = watch2.Elapsed;
                watch2.Reset();
                if (ii % 20 == 0)
                {
                    Console.WriteLine("Line " + stepnu + " out of " + h + " for zoomnum = " + zoomnum);
                    Console.WriteLine("TIME FOR LINE: " + dtper);
                }
            }
            watch.Stop();
            dt = watch.Elapsed;
            Console.WriteLine("TIME FOR THING TOTAL: " + dt);

            moopo = GetDataPicture();
            moopo.Save(set.root + "plot_" + set.id + "_" + zoomnum + ".jpeg", System.Drawing.Imaging.ImageFormat.Jpeg);
        }
Example #3
0
        public void GoThrough()
        {
            opm.cvalplug      = new Complex();
            opm.cvalplug.cpow = 0;
            ind      = 0;
            noutside = 0;
            ninside  = 0;
            coldata  = new byte[nsteps * nsteps * 4];

            arind = 0;
            for (int ii = 0; ii < nsteps; ii++)
            {
                if (true)
                {
                    Console.WriteLine("STEP " + ii + " out of " + nsteps);
                }
                for (int jj = 0; jj < nsteps; jj++)
                {
                    opm.cvalplug      = new Complex();
                    opm.cvalplug.cpow = 0;
                    opm.cvalplug.num  = new Decimal[2] {
                        curpos[0], curpos[1]
                    };
                    if (false)
                    {
                        cop.PrintNumber(opm.cvalplug);
                    }
                    opm.PlugIn(0, opm.set.poly);
                    points.Add(new MPoint());

                    points[ind].ijvals = new int[2] {
                        ii, jj
                    };
                    points[ind].inset = opm.inset;
                    if (points[ind].inset)
                    {
                        ninside++;
                    }
                    else
                    {
                        noutside++;
                    }

                    points[ind].ittbreak = opm.curitt;
                    points[ind].zoomnum  = zoomnum;
                    points[ind].cval     = new Complex();
                    points[ind].cval.num = new Decimal[2] {
                        curpos[0], curpos[1]
                    };
                    points[ind].color            = new ColorVo();
                    points[ind].color.hue        = opm.col.hue;
                    points[ind].color.saturation = opm.col.saturation;
                    points[ind].color.value      = opm.col.value;
                    points[ind].color.rgb        = opm.col.rgb;
                    coldata[arind + 1]           = (byte)points[ind].color.rgb[0];
                    coldata[arind + 2]           = (byte)points[ind].color.rgb[1];
                    coldata[arind + 3]           = (byte)points[ind].color.rgb[2];

                    coldata[arind]        = 255;
                    arind                += 4;
                    points[ind].neighbors = new List <int>();
                    points[ind].nneigh    = 0;
                    for (int kk = 0; kk < 3; kk++)
                    {
                        dk = kk - 1;

                        newk = ii + dk;
                        for (int ll = 0; ll < 3; ll++)
                        {
                            dl = ll - 1;

                            newl    = jj + dl;
                            newind  = ind + dl;
                            newind += dk * nsteps;
                            bool kv = false;
                            if (ind == 6845 && false)
                            {
                                kv = true;
                                Console.WriteLine("COORDS: " + points[ind].ijvals[0] + "," + points[ind].ijvals[1] + " " + ind);
                            }
                            if (newind < 0 || newind >= nsteps * nsteps || newind == ind)
                            {
                            }
                            else
                            {
                                if (newk < 0 || newl < 0 || newk >= nsteps || newl >= nsteps)
                                {
                                }
                                else
                                {
                                    if (kv)
                                    {
                                        Console.WriteLine("NOOB " + newk + "," + newl + " " + newind);
                                    }
                                    points[ind].neighbors.Add(newind);
                                    points[ind].nneigh++;
                                }
                            }
                        }
                    }
                    if (false)
                    {
                        cop.PrintNumber(points[0].cval);
                    }
                    if (false)
                    {
                        Console.WriteLine(points[ind].ittbreak + " " + points[ind].color.rgb[0] + " " + points[ind].color.rgb[1] + " " + points[ind].color.rgb[2] + " " + points[ind].inset);
                    }
                    curpos[0] += deltax;

                    ind++;
                }
                curpos[0]  = starter[0];
                curpos[1] += deltay;
            }
            nboundary = 0;
            moopo     = GetDataPicture(nsteps, nsteps, coldata);
            moopo.Save(@"C:\Users\Pizzamine98\Desktop\genmandel\plot" + zoomnum + ".jpeg", System.Drawing.Imaging.ImageFormat.Jpeg);
            for (int ii = 0; ii < nsteps * nsteps; ii++)
            {
                nop = 0;
                nip = 0;
                if (points[ii].inset && false)
                {
                    Console.Write("NNEIGH: " + points[ii].nneigh);
                }
                foreach (int milk in points[ii].neighbors)
                {
                    if (!points[milk].inset)
                    {
                        nop++;
                    }
                    else
                    {
                        nip++;
                    }
                }
                if (points[ii].inset && false)
                {
                    Console.WriteLine(" NOP = " + nop + " NIP = " + nip);
                }
                if (nop != 0 && nip != 0 && points[ii].inset)
                {
                    nboundary++;
                    points[ii].isboundary = true;
                    boundinds.Add(ii);
                    if (true)
                    {
                        Console.WriteLine("BOUND " + ii + " " + points[ii].cval.num[0] + " " + points[ii].cval.num[1]);
                    }
                }
                else
                {
                    points[ii].isboundary = false;
                }
            }
            Console.WriteLine("ZOOMNUM " + zoomnum + " DATA:");
            Console.WriteLine("NTOT: " + ntot + " NOUTSIDE = " + noutside + " NINSIDE = " + ninside + " NBOUNDARY = " + nboundary);
        }