Jump to content

Reptillian

Members
  • Posts

    1,237
  • Joined

  • Last visited

  • Days Won

    18

Posts posted by Reptillian

  1. Description change request on Rainbowify:

    Quote

    Converts the average of RGB channel into Hue Range, and then add a gradient, and finally wrap it around to [0-1) range. This results in a image that has rainbow following the contour of the original image. Inspired by the Rainbowify effect by Jonathan Frech. G'MIC and CodeLab source provided.

     

    I think the added "This results in a image that has rainbow following the contour of the original image. " make it easier for non-coders to comprehend. I get that coders can understand it well enough without the added description.

  2. Thanks @null54, I managed to address that issue. It's unlikely these characters will be used. And the allowed convention for Premade Palette name is compatible with most OS except Mac OS 9 due to character count limit.

     

    On Premade Palette, I have a question for users here. When 3.1 arrives and you are using Premade Palette, you will note this message: "96 Colors Restriction Exceeded! Disabled Export!" when a palette containing more than 96 colors is selected. Should this export block be disabled or should it be overridden by allowing split before export? There's also other palette format that doesn't show the message such as GIMP .gpl, and JASC_PAL.

     

    This isn't something that's hard to address.

  3. 9 hours ago, Ego Eram Reputo said:

    There currently isn't a plugin that can do this

    This is actually possible to code up in G'MIC. The easiest approach  would be working with dynamic gui, and arrays. The most intuitive approach would be interactive version where you work with a window that contains the image, but that's just painful to do.

     

    Will let the OP know when it's done.

    • Like 1
  4. Thank you, @Ego Eram Reputo and @lynxster4.

     

    Another update I have for now, and I know it's not much. I upgraded Premade Palette for when 3.1 comes. There has been some changes to workflow. In addition, you'll have the option to export palettes.

     

    Note this when G'MIC 3.1 arrives, look at filename before export because Windows doesn't support certain characters. Regardless, most of them will export successfully. I should probably find a way to address that though.

    • Like 1
  5. I made the table version of it. There's a error about it being out of range. :/

     

    Table is generated from this python code

    Spoiler
    import math
    
    length=50
    precision=4
    
    init_sin_table=[round(math.sin(x/length*2*math.pi),precision) for x in range(length)]
    init_cos_table=[round(math.cos(x/length*2*math.pi),precision) for x in range(length)]
    init_tan_table=[round(math.tan(x/length*2*math.pi),precision) for x in range(length)]
    init_atan_table=[round(math.atan(x/length*2*math.pi),precision) for x in range(length)]
    
    print(len(init_sin_table))
    
    sin_table="double[] sin_table={"+",".join(map(str,init_sin_table))+"};"
    cos_table="double[] cos_table={"+",".join(map(str,init_cos_table))+"};"
    tan_table="double[] tan_table={"+",".join(map(str,init_tan_table))+"};"
    atan_table="double[] atan_table={"+",".join(map(str,init_atan_table))+"};"
    
    print(sin_table)
    print(cos_table)
    print(tan_table)
    print(atan_table)

     

     

    C#

    Spoiler
    // Name: Popcorn Fractal
    // Submenu: Render
    // Author: Reptorian
    // Title: Popcorn Fractal
    // Version: 1
    // Desc: Render Popcorn Fractal into canvas. 
    // Keywords: fractal
    // URL: https://forums.getpaint.net/profile/85868-reptillian/
    // Help: 
    #region UICode
    IntSliderControl pts = 25; // [1,100] Points
    DoubleSliderControl var_density = 1; // [0.01,2] Density
    DoubleSliderControl H = 0.05; // [-5,5] H
    DoubleSliderControl K = 3; // [-75,75] K
    DoubleSliderControl var_zoom = 1; // [0.1,4] Zoom
    AngleControl var_ang = 0; // [-180,180] Angle
    PanSliderControl Origin = Pair.Create(0.000, 0.000); // Origin
    ListBoxControl TrigMode = 0; // Trig Mode|Trig-4|Trig-6
    ListBoxControl func_x1 = 0; // X-S|Sinusoidal|Cosinusoidal|Tangent|Arc-Tangent
    ListBoxControl func_x2 = 2; // X-T|Sinusoidal|Cosinusoidal|Tangent|Arc-Tangent
    ListBoxControl func_x3 = 1; // {!TrigMode} X-U|Sinusoidal|Cosinusoidal|Tangent|Arc-Tangent
    ListBoxControl func_y1 = 0; // Y-S|Sinusoidal|Cosinusoidal|Tangent|Arc-Tangent
    ListBoxControl func_y2 = 2; // Y-T|Sinusoidal|Cosinusoidal|Tangent|Arc-Tangent
    ListBoxControl func_y3 = 1; // {!TrigMode} Y-U|Sinusoidal|Cosinusoidal|Tangent|Arc-Tangent
    DoubleSliderControl var_midpoint_shift = 0; // [-1,1] Midpoint Shift
    DoubleSliderControl multiplier = 1; // [0.01,10] {!norm} Multiplier
    CheckboxControl norm = false; // Normalize
    #endregion
    #if DEBUG
    #endif
    
    double length=50;
    double[] sin_table={0.0,0.1253,0.2487,0.3681,0.4818,0.5878,0.6845,0.7705,0.8443,0.9048,0.9511,0.9823,0.998,0.998,0.9823,0.9511,0.9048,0.8443,0.7705,0.6845,0.5878,0.4818,0.3681,0.2487,0.1253,0.0,-0.1253,-0.2487,-0.3681,-0.4818,-0.5878,-0.6845,-0.7705,-0.8443,-0.9048,-0.9511,-0.9823,-0.998,-0.998,-0.9823,-0.9511,-0.9048,-0.8443,-0.7705,-0.6845,-0.5878,-0.4818,-0.3681,-0.2487,-0.1253};
    double[] cos_table={1.0,0.9921,0.9686,0.9298,0.8763,0.809,0.729,0.6374,0.5358,0.4258,0.309,0.1874,0.0628,-0.0628,-0.1874,-0.309,-0.4258,-0.5358,-0.6374,-0.729,-0.809,-0.8763,-0.9298,-0.9686,-0.9921,-1.0,-0.9921,-0.9686,-0.9298,-0.8763,-0.809,-0.729,-0.6374,-0.5358,-0.4258,-0.309,-0.1874,-0.0628,0.0628,0.1874,0.309,0.4258,0.5358,0.6374,0.729,0.809,0.8763,0.9298,0.9686,0.9921};
    double[] tan_table={0.0,0.1263,0.2568,0.3959,0.5498,0.7265,0.9391,1.2088,1.5757,2.1251,3.0777,5.2422,15.8945,-15.8945,-5.2422,-3.0777,-2.1251,-1.5757,-1.2088,-0.9391,-0.7265,-0.5498,-0.3959,-0.2568,-0.1263,-0.0,0.1263,0.2568,0.3959,0.5498,0.7265,0.9391,1.2088,1.5757,2.1251,3.0777,5.2422,15.8945,-15.8945,-5.2422,-3.0777,-2.1251,-1.5757,-1.2088,-0.9391,-0.7265,-0.5498,-0.3959,-0.2568,-0.1263};
    
    double rot_x(double a, double b, double cos_ang,double sin_ang){
        return a * cos_ang - b * sin_ang;
    }
    
    double rot_y(double a, double b, double cos_ang,double sin_ang){
        return a * sin_ang + b * cos_ang;
    }
    
    double rescale_factor=2*Math.PI/50;
    
    double table_sin(double v){
        int index=(int)(v/rescale_factor);
        return sin_table[index%50];
    }
    
    double table_cos(double v){
        int index=(int)(v/rescale_factor);
        return cos_table[index%50];
    }
    
    double table_tan(double v){
        int index=(int)(v/rescale_factor);
        return tan_table[index%50];
    }
    
    double func_v(double v,int c){
        switch(c){
           case 0: return table_sin(v);
           case 1: return Math.Cos(v);
           case 2: return Math.Tan(v);
           case 3: return Math.Atan(v);
        }
        return Math.Atan(v);
    }
    
    int maxnum;
    int [,] Popcorn_Array;
    
    void PreRender(Surface dst, Surface src)
    {
        int w = src.Width;
        int h = src.Height;    
        bool sd_cond = w>h;
        double dw = (double)(w);
        double dh = (double)(h);
        if (Popcorn_Array == null){Popcorn_Array = new int [w,h];}
        else {Array.Clear(Popcorn_Array, 0, w*h);}
        bool use_trig6 = TrigMode == 1;
        double density = 1 / var_density;
        double zoom = 1 / var_zoom;
        double ang = (var_ang/180) * Math.PI;
        double origin_x = Origin.First * -1 * zoom;
        double origin_y = Origin.Second * zoom;
        double sd = Math.Max(dw,dh) / Math.Min(dw,dh);
        double sx = sd_cond ? sd : 1  ;
        double sy = sd_cond ? 1  : sd ;
        double cx = dw / 2;
        double cy = dh / 2;
        double osx = origin_x * sx ;
        double osy = origin_y * sy ;
        double cx_zoom = cx / zoom;
        double cy_zoom = cy / zoom;
        double cxsx = cx * sx;
        double cysy = cy * sy;
        double cos_ang = Math.Cos(ang);
        double sin_ang = Math.Sin(ang);
        bool angcondition = (var_ang - 360*Math.Floor(var_ang/360))>0;
        double xx,yy,xnew,ynew,xval,yval;
        int xpos,ypos;
        var timer = new Stopwatch();
    
        timer.Start();
    
        for (double ix=0 ; ix < dw ; ix+=density)
        {
            if (IsCancelRequested) return;
    
            for (double iy=0 ; iy < dh ; iy+=density)
            {
                xx = zoom * (ix-cx) / cx;
                yy = zoom * (iy-cy) / cy;
                xx*=sx;
                yy*=sy;
                xx+=origin_x;
                yy+=origin_y;
    
                for (int ptn=0 ; ptn < pts ; ptn++)
                {
                    if (use_trig6) {
                        xnew  = xx-H*func_v(yy+func_v(K*yy+func_v(K*yy,func_x3),func_x2),func_x1);
                        ynew  = yy-H*func_v(xx+func_v(K*xx+func_v(K*xx,func_y3),func_y2),func_y1);
                    }
                    else {
                        xnew = xx-H*func_v(yy+func_v(K*yy,func_x2),func_x1);
                        ynew = yy-H*func_v(xx+func_v(K*xx,func_y2),func_y1);
                    }
    
                    if (angcondition){
                        xval = ((rot_x(xnew,ynew,cos_ang,sin_ang) - osx)*cx_zoom + cxsx)/sx;
                        yval = ((rot_y(xnew,ynew,cos_ang,sin_ang) - osy)*cy_zoom + cysy)/sy;
                    }
                    else{
                        xval = ((xnew - osx)*cx_zoom+cxsx)/sx;
                        yval = ((ynew - osy)*cy_zoom+cysy)/sy;
                    }
    
                    xpos = (int)(Math.Round(xval));
                    ypos = (int)(Math.Round(yval));
                    
                    if ((xpos>=0&&ypos>=0)&&(xpos<w&&ypos<h)){
                        Popcorn_Array[xpos,ypos]++;
                        if (Popcorn_Array[xpos,ypos]>maxnum) { maxnum = Popcorn_Array[xpos,ypos]; }
                    }
    
                    xx = xnew;
                    yy = ynew;
                }
            }
        }
    
        timer.Stop();
        Debug.WriteLine(timer.Elapsed);
    }
    
    void Render(Surface dst, Surface src, Rectangle rect)
    {
        double midpoint = 1 - Math.Abs(var_midpoint_shift);
        bool cond_midpoint = var_midpoint_shift>=0;
        double pval;
        int val;
    
        for (int y = rect.Top; y < rect.Bottom; y++)
        {        
            for (int x = rect.Left; x < rect.Right; x++)
            {
                pval = (double)(Popcorn_Array[x,y])/(double)(maxnum);
                if (cond_midpoint){pval=Math.Pow(pval,midpoint);}
                else {pval=1-(Math.Pow(1-pval,midpoint));}
                if(norm){pval*=255;}
                else {pval*=(double)(maxnum)*multiplier;}
                val=(int)(pval);
                dst[x,y]=ColorBgra.FromBgraClamped(val,val,val,255);
            }
        }
    }

     

     

  6. 6 hours ago, NinthDesertDude said:

    Thoughts for speed...

     

    1. Parallelize the for loops in your pre-render if you can. It's worth tracking two copies of xx/yy and each intermediate variable you defined outside the for-loops, if that's necessary to make it work. Speed will definitely improve if it's at all possible.

     

    This is something I'm interested into doing. How to parallelize it. It's not possible to put it in render.

     

    On 2. That might take some time to be doing. Doable, but takes a bit of time. I doubt that they do affect performance that much. My test with dummy code shows it is at least 2 times faster. Half as fast as the multi-threaded version coded in G'MIC. I will see if the table suggestion works.

  7. A long time ago, @MJWsuggested I should use delegate for Popcorn Fractal. I had done that, but however it is slower than non-lambda delegate version. It was supposed to be faster.

     

    Here's the two codes with StopWatch and Debug built-in. The  A is the non-lambda delegate version, and the B is the lambda delegate version. B is newer than A.

     

    Popcorn Fractal A

     

    Spoiler
    // Name: Popcorn Fractal
    // Submenu: Render
    // Author: Reptorian
    // Title: Popcorn Fractal
    // Version: 1
    // Desc: Render Popcorn Fractal into canvas. 
    // Keywords: fractal
    // URL: https://forums.getpaint.net/profile/85868-reptillian/
    // Help: 
    #region UICode
    IntSliderControl pts = 25; // [1,100] Points
    DoubleSliderControl var_density = 1; // [0.01,2] Density
    DoubleSliderControl H = 0.05; // [-5,5] H
    DoubleSliderControl K = 3; // [-75,75] K
    DoubleSliderControl var_zoom = 1; // [0.1,4] Zoom
    AngleControl var_ang = 0; // [-180,180] Angle
    PanSliderControl Origin = Pair.Create(0.000, 0.000); // Origin
    ListBoxControl TrigMode = 0; // Trig Mode|Trig-4|Trig-6
    ListBoxControl func_x1 = 0; // X-S|Sinusoidal|Cosinusoidal|Tangent|Arc-Tangent
    ListBoxControl func_x2 = 2; // X-T|Sinusoidal|Cosinusoidal|Tangent|Arc-Tangent
    ListBoxControl func_x3 = 1; // {!TrigMode} X-U|Sinusoidal|Cosinusoidal|Tangent|Arc-Tangent
    ListBoxControl func_y1 = 0; // Y-S|Sinusoidal|Cosinusoidal|Tangent|Arc-Tangent
    ListBoxControl func_y2 = 2; // Y-T|Sinusoidal|Cosinusoidal|Tangent|Arc-Tangent
    ListBoxControl func_y3 = 1; // {!TrigMode} Y-U|Sinusoidal|Cosinusoidal|Tangent|Arc-Tangent
    DoubleSliderControl var_midpoint_shift = 0; // [-1,1] Midpoint Shift
    DoubleSliderControl multiplier = 1; // [0.01,10] {!norm} Multiplier
    CheckboxControl norm = false; // Normalize
    #endregion
    #if DEBUG
    #endif
    
    double rot_x(double a, double b, double cos_ang,double sin_ang){
        return a * cos_ang - b * sin_ang;
    }
    
    double rot_y(double a, double b, double cos_ang,double sin_ang){
        return a * sin_ang + b * cos_ang;
    }
    
    
    double func_v(double v,int c){
        switch(c){
           case 0: return Math.Sin(v);
           case 1: return Math.Cos(v);
           case 2: return Math.Tan(v);
           case 3: return Math.Atan(v);
        }
        return Math.Atan(v);
    }
    
    int maxnum;
    int [,] Popcorn_Array;
    
    void PreRender(Surface dst, Surface src)
    {
        int w = src.Width;
        int h = src.Height;    
        bool sd_cond = w>h;
        double dw = (double)(w);
        double dh = (double)(h);
        if (Popcorn_Array == null){Popcorn_Array = new int [w,h];}
        else {Array.Clear(Popcorn_Array, 0, w*h);}
        bool use_trig6 = TrigMode == 1;
        double density = 1 / var_density;
        double zoom = 1 / var_zoom;
        double ang = (var_ang/180) * Math.PI;
        double origin_x = Origin.First * -1 * zoom;
        double origin_y = Origin.Second * zoom;
        double sd = Math.Max(dw,dh) / Math.Min(dw,dh);
        double sx = sd_cond ? sd : 1  ;
        double sy = sd_cond ? 1  : sd ;
        double cx = dw / 2;
        double cy = dh / 2;
        double osx = origin_x * sx ;
        double osy = origin_y * sy ;
        double cx_zoom = cx / zoom;
        double cy_zoom = cy / zoom;
        double cxsx = cx * sx;
        double cysy = cy * sy;
        double cos_ang = Math.Cos(ang);
        double sin_ang = Math.Sin(ang);
        bool angcondition = (var_ang - 360*Math.Floor(var_ang/360))>0;
        double xx,yy,xnew,ynew,xval,yval;
        int xpos,ypos;
        var timer = new Stopwatch();
    
        timer.Start();
    
        for (double ix=0 ; ix < dw ; ix+=density)
        {
            if (IsCancelRequested) return;
    
            for (double iy=0 ; iy < dh ; iy+=density)
            {
                xx = zoom * (ix-cx) / cx;
                yy = zoom * (iy-cy) / cy;
                xx*=sx;
                yy*=sy;
                xx+=origin_x;
                yy+=origin_y;
    
                for (int ptn=0 ; ptn < pts ; ptn++)
                {
                    if (use_trig6) {
                        xnew  = xx-H*func_v(yy+func_v(K*yy+func_v(K*yy,func_x3),func_x2),func_x1);
                        ynew  = yy-H*func_v(xx+func_v(K*xx+func_v(K*xx,func_y3),func_y2),func_y1);
                    }
                    else {
                        xnew = xx-H*func_v(yy+func_v(K*yy,func_x2),func_x1);
                        ynew = yy-H*func_v(xx+func_v(K*xx,func_y2),func_y1);
                    }
    
                    if (angcondition){
                        xval = ((rot_x(xnew,ynew,cos_ang,sin_ang) - osx)*cx_zoom + cxsx)/sx;
                        yval = ((rot_y(xnew,ynew,cos_ang,sin_ang) - osy)*cy_zoom + cysy)/sy;
                    }
                    else{
                        xval = ((xnew - osx)*cx_zoom+cxsx)/sx;
                        yval = ((ynew - osy)*cy_zoom+cysy)/sy;
                    }
    
                    xpos = (int)(Math.Round(xval));
                    ypos = (int)(Math.Round(yval));
                    
                    if ((xpos>=0&&ypos>=0)&&(xpos<w&&ypos<h)){
                        Popcorn_Array[xpos,ypos]++;
                        if (Popcorn_Array[xpos,ypos]>maxnum) { maxnum = Popcorn_Array[xpos,ypos]; }
                    }
    
                    xx = xnew;
                    yy = ynew;
                }
            }
        }
    
        timer.Stop();
        Debug.WriteLine(timer.Elapsed);
    }
    
    void Render(Surface dst, Surface src, Rectangle rect)
    {
        double midpoint = 1 - Math.Abs(var_midpoint_shift);
        bool cond_midpoint = var_midpoint_shift>=0;
        double pval;
        int val;
    
        for (int y = rect.Top; y < rect.Bottom; y++)
        {        
            for (int x = rect.Left; x < rect.Right; x++)
            {
                pval = (double)(Popcorn_Array[x,y])/(double)(maxnum);
                if (cond_midpoint){pval=Math.Pow(pval,midpoint);}
                else {pval=1-(Math.Pow(1-pval,midpoint));}
                if(norm){pval*=255;}
                else {pval*=(double)(maxnum)*multiplier;}
                val=(int)(pval);
                dst[x,y]=ColorBgra.FromBgraClamped(val,val,val,255);
            }
        }
    }

     

     

    Popcorn Fractal B

     

    Spoiler
    // Name: Popcorn Fractal
    // Submenu: Render
    // Author: Reptorian
    // Title: Popcorn Fractal
    // Version: 1
    // Desc: Render Popcorn Fractal into canvas. 
    // Keywords: fractal
    // URL: https://forums.getpaint.net/profile/85868-reptillian/
    // Help: 
    #region UICode
    IntSliderControl pts = 25; // [1,100] Points
    DoubleSliderControl var_density = 1; // [0.01,2] Density
    DoubleSliderControl H = 0.05; // [-5,5] H
    DoubleSliderControl K = 3; // [-75,75] K
    DoubleSliderControl var_zoom = 1; // [0.1,4] Zoom
    AngleControl var_ang = 0; // [-180,180] Angle
    PanSliderControl Origin = Pair.Create(0.000, 0.000); // Origin
    ListBoxControl TrigMode = 0; // Trig Mode|Trig-4|Trig-6
    ListBoxControl func_x1 = 0; // X-S|Sinusoidal|Cosinusoidal|Tangent|Arc-Tangent
    ListBoxControl func_x2 = 2; // X-T|Sinusoidal|Cosinusoidal|Tangent|Arc-Tangent
    ListBoxControl func_x3 = 1; // {!TrigMode} X-U|Sinusoidal|Cosinusoidal|Tangent|Arc-Tangent
    ListBoxControl func_y1 = 0; // Y-S|Sinusoidal|Cosinusoidal|Tangent|Arc-Tangent
    ListBoxControl func_y2 = 2; // Y-T|Sinusoidal|Cosinusoidal|Tangent|Arc-Tangent
    ListBoxControl func_y3 = 1; // {!TrigMode} Y-U|Sinusoidal|Cosinusoidal|Tangent|Arc-Tangent
    DoubleSliderControl var_midpoint_shift = 0; // [-1,1] Midpoint Shift
    DoubleSliderControl multiplier = 1; // [0.01,10] {!norm} Multiplier
    CheckboxControl norm = false; // Normalize
    #endregion
    #if DEBUG
    #endif
    
    double rot_x(double a, double b, double cos_ang,double sin_ang){
        return a * cos_ang - b * sin_ang;
    }
    
    double rot_y(double a, double b, double cos_ang,double sin_ang){
        return a * sin_ang + b * cos_ang;
    }
    
    int maxnum;
    int [,] Popcorn_Array;
    
    void PreRender(Surface dst, Surface src)
    {
        int w = src.Width;
        int h = src.Height;    
        bool sd_cond = w>h;
        double dw = (double)(w);
        double dh = (double)(h);
        if (Popcorn_Array == null){Popcorn_Array = new int [w,h];}
        else {Array.Clear(Popcorn_Array, 0, w*h);}
        bool use_trig6 = TrigMode == 1;
        double density = 1 / var_density;
        double zoom = 1 / var_zoom;
        double ang = (var_ang/180) * Math.PI;
        double origin_x = Origin.First * -1 * zoom;
        double origin_y = Origin.Second * -1 * zoom;
        double sd = Math.Max(dw,dh) / Math.Min(dw,dh);
        double sx = sd_cond ? sd : 1  ;
        double sy = sd_cond ? 1  : sd ;
        double cx = dw / 2;
        double cy = dh / 2;
        double osx = origin_x * sx ;
        double osy = origin_y * sy ;
        double cx_zoom = cx / zoom;
        double cy_zoom = cy / zoom;
        double cxsx = cx * sx;
        double cysy = cy * sy;
        double cos_ang = Math.Cos(ang);
        double sin_ang = Math.Sin(ang);
        bool angcondition = (var_ang - 360*Math.Floor(var_ang/360))>0;
        double xx,yy,xnew,ynew,xval,yval;
        int xpos,ypos;
    
        Func<double,double,double> eval_x;
        Func<double,double,double> eval_y;
        Func<double,double> fun_x0 = v => 0;
        Func<double,double> fun_x1 = v => 0;   
        Func<double,double> fun_y0 = v => 0;
        Func<double,double> fun_y1 = v => 0;   
        Func<double,double,double> popcorn_x;
        Func<double,double,double> popcorn_y;
    
        switch(func_x1){
                case 0: 
                    fun_x0 = v => Math.Sin(v);
                    break;
                case 1:
                    fun_x0 = v => Math.Cos(v);
                    break;
                case 2: 
                    fun_x0 = v => Math.Tan(v);
                    break;
                case 3:
                    fun_x0 = v => Math.Atan(v);
                    break;
        }
    
        switch(func_x2){
                case 0: 
                    fun_x1 = v => Math.Sin(v);
                    break;
                case 1:
                    fun_x1 = v => Math.Cos(v);
                    break;
                case 2: 
                    fun_x1 = v => Math.Tan(v);
                    break;
                case 3:
                    fun_x1 = v => Math.Atan(v);
                    break;
        }
    
        switch(func_y1){
                case 0: 
                    fun_y0 = v => Math.Sin(v);
                    break;
                case 1:
                    fun_y0 = v => Math.Cos(v);
                    break;
                case 2: 
                    fun_y0 = v => Math.Tan(v);
                    break;
                case 3:
                    fun_y0 = v => Math.Atan(v);
                    break;
        }
    
        switch(func_y2){
                case 0: 
                    fun_y1 = v => Math.Sin(v);
                    break;
                case 1:
                    fun_y1 = v => Math.Cos(v);
                    break;
                case 2: 
                    fun_y1 = v => Math.Tan(v);
                    break;
                case 3:
                    fun_y1 = v => Math.Atan(v);
                    break;
        }
    
        if (use_trig6){
            Func<double,double> fun_x2 = v => 0;
            Func<double,double> fun_y2 = v => 0;
    
            switch(func_x3){
                case 0: 
                    fun_x2 = v => Math.Sin(v);
                    break;
                case 1:
                    fun_x2 = v => Math.Cos(v);
                    break;
                case 2: 
                    fun_x2 = v => Math.Tan(v);
                    break;
                case 3:
                    fun_x2 = v => Math.Atan(v);
                    break;
            }
            switch(func_y3){
                case 0: 
                    fun_y2 = v => Math.Sin(v);
                    break;
                case 1:
                    fun_y2 = v => Math.Cos(v);
                    break;
                case 2: 
                    fun_y2 = v => Math.Tan(v);
                    break;
                case 3:
                    fun_y2 = v => Math.Atan(v);
                    break;
            }
            popcorn_x = (a,b) => a - H * fun_x0(b+fun_x1(K*b + fun_x2(K*b)));
            popcorn_y = (a,b) => b - H * fun_y0(a+fun_y1(K*a + fun_y2(K*a)));
        }
        else {
            popcorn_x = (a,b) => a - H * fun_x0(b + fun_x1(K * b));
            popcorn_y = (a,b) => b - H * fun_y0(a + fun_y1(K * a));
        }
    
        if (angcondition){
            eval_x = ( x,y )  => ((rot_x(x,y,cos_ang,sin_ang) - osx)*cx_zoom + cxsx)/sx;
            eval_y = ( x,y )  => ((rot_y(x,y,cos_ang,sin_ang) - osy)*cy_zoom + cysy)/sy;
        }
        else{
            eval_x = ( x,y ) => ((x - osx)*cx_zoom+cxsx)/sx;
            eval_y = ( x,y ) => ((y - osy)*cy_zoom+cysy)/sy;
        }
    
        var timer = new Stopwatch();
    
        timer.Start();
    
        for (double ix=0 ; ix < dw ; ix+=density)
        {
            if (IsCancelRequested) return;
    
            for (double iy=0 ; iy < dh ; iy+=density)
            {
                xx = zoom * (ix-cx) / cx;
                yy = zoom * (iy-cy) / cy;
                xx*=sx;
                yy*=sy;
                xx+=origin_x;
                yy+=origin_y;
    
                for (int ptn=0 ; ptn < pts ; ptn++)
                {
    
                    xnew = popcorn_x(xx,yy);
                    ynew = popcorn_y(xx,yy);
    
                    xval = eval_x(xnew,ynew);
                    yval = eval_y(xnew,ynew);
    
                    xpos = (int)(Math.Round(xval));
                    ypos = (int)(Math.Round(yval));
                    
                    if ((xpos>=0&&ypos>=0)&&(xpos<w&&ypos<h)){
                        Popcorn_Array[xpos,ypos]++;
                        if (Popcorn_Array[xpos,ypos]>maxnum) { maxnum = Popcorn_Array[xpos,ypos]; }
                    }
    
                    xx = xnew;
                    yy = ynew;
                }
            }
        }
    
        timer.Stop();
        Debug.WriteLine(timer.Elapsed);
    }
    
    void Render(Surface dst, Surface src, Rectangle rect)
    {
        double midpoint = 1 - Math.Abs(var_midpoint_shift);
        bool cond_midpoint = var_midpoint_shift>=0;
        double pval;
        int val;
    
        for (int y = rect.Top; y < rect.Bottom; y++)
        {        
            for (int x = rect.Left; x < rect.Right; x++)
            {
                pval = (double)(Popcorn_Array[x,y])/(double)(maxnum);
                if (cond_midpoint){pval=Math.Pow(pval,midpoint);}
                else {pval=1-(Math.Pow(1-pval,midpoint));}
                if(norm){pval*=255;}
                else {pval*=(double)(maxnum)*multiplier;}
                val=(int)(pval);
                dst[x,y]=ColorBgra.FromBgraClamped(val,val,val,255);
            }
        }
    }

     

     

  8. 33 minutes ago, HyReZ said:

    Search for the Windows Charaater Map app (bulit into every version of Windows), then scroll thru the map to locate and select your characters into the Select box.

    Next click 'copy' to place your selections onto the Clipboard and paste into Paint.NET (or an other app the use text).

    You can also use WinCompose.

     

    Here's some examples with Umlaut.

     

    äÄëËöÖ.

     

    It is better than Windows Character Map.

  9. 9 minutes ago, memark said:

    Thanks, I guess i have asked the wrong question. I can not get the proper function or key stroke to get these umlauts to type out.

     

    There are tools for that. I forgot the name for this, but it's when you type in a key, and then type in combination of keys, finally, the character shows up.

  10. 31 minutes ago, MJW said:

    In answer to that question: No, the "gravity" is always directional.

    I think the person is asking for a new feature. This is actually feasible.

     

    There is something I have made that makes this much more feasible -> https://discuss.pixls.us/t/rectangular-polar-transformation-sequel-thread/22724 .

     

    The above is about transforming a image which can be combined with Gravity to do this. I also have a G'MIC that does this with the aforementioned technique.

  11. 11 hours ago, Ego Eram Reputo said:

     

    There isn't a plugin which will do this. That's not to say there won't be, just not right now.

    There might be something in a set of G'MIC script someone left in the cartographer forum. Those can actually be easily translated to C# plugin. I would have to finish those as they are not coded acceptably. Then, when I finish them, someone who wants them in a C# plugin can ask me for pointers.

    • Like 1
×
×
  • Create New...