示例#1
0
        public static RayImage ArrayLogRangeXY(double[,] imagedata_in, ColorGradient c)
        {
            int ni = imagedata_in.GetLength(0);
            int nj = imagedata_in.GetLength(1);

            double[,] imagedata = new double[ni, nj];
            for (int i = 0; i < ni; i++)
            {
                for (int j = 0; j < nj; j++)
                {
                    imagedata[i, j] = Math.Log10(Math.Abs(imagedata_in[i, j]) + 1e-10);
                }
            }
            RayImage output = new RayImage(ni, nj);
            double   minn   = double.PositiveInfinity;
            double   maxx   = double.NegativeInfinity;

            for (int i = 0; i < ni; i++)
            {
                for (int j = 0; j < nj; j++)
                {
                    maxx = (imagedata[i, j] > maxx) ? imagedata[i, j] : maxx;
                    minn = (imagedata[i, j] < minn) ? imagedata[i, j] : minn;
                }
            }
            for (int i = 0; i < ni; i++)
            {
                for (int j = 0; j < nj; j++)
                {
                    output.SetPixelXY(i, j, c.GetColor(imagedata[i, j], minn, maxx));
                }
            }
            return(output);
        }
示例#2
0
        public static RayImage ArrayRangeXY(double[,] imagedata, ColorGradient c)
        {
            int      ni     = imagedata.GetLength(0);
            int      nj     = imagedata.GetLength(1);
            RayImage output = new RayImage(ni, nj);
            double   minn   = double.PositiveInfinity;
            double   maxx   = double.NegativeInfinity;

            for (int i = 0; i < ni; i++)
            {
                for (int j = 0; j < nj; j++)
                {
                    maxx = (imagedata[i, j] > maxx) ? imagedata[i, j] : maxx;
                    minn = (imagedata[i, j] < minn) ? imagedata[i, j] : minn;
                }
            }
            for (int i = 0; i < ni; i++)
            {
                for (int j = 0; j < nj; j++)
                {
                    Triple col = c.GetColor(imagedata[i, j], minn, maxx);
                    output.SetPixelXY(i, j, col);
                }
            }
            return(output);
        }
示例#3
0
 private void render_single(int i)
 {
     for (int j = 0; j < ny; j++)
     {
         im.SetPixelXY(i, j, GetBackgroundColor(rays[i, j]));
     }
 }
示例#4
0
 private void render_single(int i)
 {
     //Console.WriteLine(i);
     for (int j = 0; j < ny; j++)
     {
         //depth = 1 is a temporary fix!!
         Triple color = TraceRay(rays[i, j], 2, out bodyid_field[i, j], out distance_field[i, j], out times_field[i, j]);
         im.SetPixelXY(i, j, color);
     }
 }
示例#5
0
 public RayImage BasicRender(Camera c)
 {
     rays = c.GetRays();
     im   = new RayImage(c.NX, c.NY);
     nx   = c.NX;
     ny   = c.NY;
     if (par_rdr)
     {
         Parallel.For(0, nx, render_single);
     }
     else
     {
         for (int i = 0; i < c.NX; i++)
         {
             for (int j = 0; j < c.NY; j++)
             {
                 im.SetPixelXY(i, j, GetBackgroundColor(rays[i, j]));
             }
         }
     }
     return(im);
 }