当前位置: 首页>>代码示例>>C#>>正文


C# ISurface.xRad方法代码示例

本文整理汇总了C#中ISurface.xRad方法的典型用法代码示例。如果您正苦于以下问题:C# ISurface.xRad方法的具体用法?C# ISurface.xRad怎么用?C# ISurface.xRad使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ISurface的用法示例。


在下文中一共展示了ISurface.xRad方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetMeshGaussianPoints

        /// <summary>
        /// Creates a regular grid of 3dpoints from the Surface on the specified uv-interval and colors them by gaussian
        /// </summary>
        /// <param name="s">the surface to mesh</param>
        /// <param name="ROWS">the number of constant-u sections</param>
        /// <param name="COLS">the number of constant-v sections</param>
        /// <param name="uvLim">(optional)the uv limits to mesh, uvLim[0,x] = uLim, uvLim[1,x] = vLim</param>
        /// <returns>the grid of points for meshing</returns>
        public static PointRGB[] GetMeshGaussianPoints(ISurface s, int ROWS, int COLS, double[,] uvLim)
        {
            Vect2 uv = new Vect2();
            Vect3 xyz = new Vect3();
            List<Vect3> xyzs = new List<Vect3>(ROWS * COLS);
            PointRGB[] meshpts = new PointRGB[ROWS * COLS];
            double[] gauss = new double[ROWS * COLS];
            double kMax = -1e9, kMin = 1e9;
            int i = 0;
            for (int iU = 0; iU < ROWS; iU++)
            {
                uv[0] = BLAS.interpolate((double)iU / (double)(ROWS - 1), uvLim[0, 1], uvLim[0, 0]);
                //uv[0] = (double)iU / (double)(ROWS - 1);
                for (int iV = 0; iV < COLS; iV++, i++)
                {
                    uv[1] = BLAS.interpolate((double)iV / (double)(COLS - 1), uvLim[1, 1], uvLim[1, 0]);
                    //uv[1] = (double)iV / (double)(COLS - 1);
                    s.xRad(uv, ref xyz, ref gauss[i]);
                    //copy to temp array
                    xyzs.Add(new Vect3(xyz));
                    //meshpts[i].X = xyz[0];
                    //meshpts[i].Y = xyz[1];
                    //meshpts[i].Z = xyz[2];
                    //track max/min for color scale
                    kMax = Math.Max(kMax, gauss[i]);
                    kMin = Math.Min(kMin, gauss[i]);
                }
            }
            double ave, q1, q3, stddev = BLAS.StandardDeviation(gauss, out ave, out q3, out q1);
            Color c;
            for (i = 0; i < meshpts.Length; i++)
            {
                c = ColorMath.GetScaleColor(ave + 2 * stddev, ave - 2 * stddev, gauss[i]);
                meshpts[i] = new PointRGB(xyzs[i][0], xyzs[i][1], xyzs[i][2], c);
            }

            return meshpts;
        }
开发者ID:GabeTesta,项目名称:Warps,代码行数:46,代码来源:ISurface.cs

示例2: CheckError

        double CheckError(ISurface cof)
        {
            int ROWS = 30, COLS = 30;

            Vect2 uv = new Vect2();
            Vect3 xyz = new Vect3();
            int i, j;
            double kThis=0, kCof=0, err=0;
            for (i = 0; i < ROWS; i++)
            {
                uv[0] = BLAS.interpolant(i, ROWS);
                for (j = 0; j < COLS; j++)
                {
                    uv[1] = BLAS.interpolant(j, COLS);
                    cof.xRad(uv, ref xyz, ref kCof);
                    xRad(uv, ref xyz, ref kThis);
                    err = Math.Pow(kCof - kThis, 2);
                }
            }
            err /= (ROWS*COLS);
            return err;
        }
开发者ID:GabeTesta,项目名称:Warps,代码行数:22,代码来源:RBFMould.cs


注:本文中的ISurface.xRad方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。