private static void ProcessDetails(Dictionary <int, int[, ]> details, Expression.DslCalculator calc, string proc, int cx, int cy, int r)
    {
        int x  = cx - r;
        int y  = cy - r;
        int w  = r * 2;
        int h  = r * 2;
        int r2 = r * r;

        for (int ix = 0; ix < w; ++ix)
        {
            for (int iy = 0; iy < h; ++iy)
            {
                int xi = x + ix;
                int yi = y + iy;
                int dx = xi - cx;
                int dy = yi - cy;
                if (dx * dx + dy * dy <= r2)
                {
                    foreach (var pair in details)
                    {
                        int layer  = pair.Key;
                        var detail = pair.Value[xi, yi];
                        calc.SetVariable("detail", detail);
                        calc.Calc(proc, xi, yi, layer);
                        pair.Value[xi, yi] = (int)Convert.ChangeType(calc.GetVariable("detail"), typeof(int));
                    }
                }
            }
        }
    }
    private static void ProcessHeights(float[,] datas, Expression.DslCalculator calc, string proc, int cx, int cy, int r)
    {
        int x  = cx - r;
        int y  = cy - r;
        int w  = r * 2;
        int h  = r * 2;
        int r2 = r * r;

        for (int ix = 0; ix < w; ++ix)
        {
            for (int iy = 0; iy < h; ++iy)
            {
                int xi = x + ix;
                int yi = y + iy;
                int dx = xi - cx;
                int dy = yi - cy;
                if (dx * dx + dy * dy <= r2)
                {
                    calc.SetVariable("height", datas[yi, xi]);
                    calc.Calc(proc, xi, yi);
                    datas[yi, xi] = (float)Convert.ChangeType(calc.GetVariable("height"), typeof(float));
                }
            }
        }
    }
 private static void ProcessHeights(float[,] datas, Expression.DslCalculator calc, string proc, int x, int y, int w, int h)
 {
     for (int ix = 0; ix < w; ++ix)
     {
         for (int iy = 0; iy < h; ++iy)
         {
             int xi = x + ix;
             int yi = y + iy;
             calc.SetVariable("height", datas[yi, xi]);
             calc.Calc(proc, xi, yi);
             datas[yi, xi] = (float)Convert.ChangeType(calc.GetVariable("height"), typeof(float));
         }
     }
 }
 private static void ProcessDetails(Dictionary <int, int[, ]> details, Expression.DslCalculator calc, string proc, int x, int y, int w, int h)
 {
     for (int ix = 0; ix < w; ++ix)
     {
         for (int iy = 0; iy < h; ++iy)
         {
             int xi = x + ix;
             int yi = y + iy;
             foreach (var pair in details)
             {
                 int layer  = pair.Key;
                 var detail = pair.Value[xi, yi];
                 calc.SetVariable("detail", detail);
                 calc.Calc(proc, xi, yi, layer);
                 pair.Value[xi, yi] = (int)Convert.ChangeType(calc.GetVariable("detail"), typeof(int));
             }
         }
     }
 }