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


C# ISurface.xVal方法代码示例

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


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

示例1: GetExtensionPoints

 //public static Mesh GetMesh(ISurface s, int rows, int cols, bool bGauss)
 //{
 //    //Mesh mesh = new Mesh(meshNatureType.RichPlain);
 //    meshNatureType meshtype = bGauss ? meshNatureType.MulticolorPlain : meshNatureType.ColorPlain;
 //    Mesh mesh = new Mesh(meshtype);
 //    mesh.ColorMethod = bGauss ? colorMethodType.byEntity : colorMethodType.byLayer;
 //    mesh.Vertices = bGauss ? SurfaceTools.GetMeshGaussianPoints(s, rows, cols, MESHLIMITS) : SurfaceTools.GetMeshPoints(s, rows, cols);
 //    mesh.RegenMode = regenType.RegenAndCompile;
 //    mesh.Triangles = new IndexTriangle[(rows - 1) * (cols - 1) * 2];
 //    int count = 0;
 //    for (int j = 0; j < (rows - 1); j++)
 //    {
 //        for (int i = 0; i < (cols - 1); i++)
 //        {
 //            mesh.Triangles[count++] = new IndexTriangle(i + j * cols,
 //                                                           i + j * cols + 1,
 //                                                           i + (j + 1) * cols + 1);
 //            mesh.Triangles[count++] = new IndexTriangle(i + j * cols,
 //                                                           i + (j + 1) * cols + 1,
 //                                                           i + (j + 1) * cols);
 //        }
 //    }
 //    mesh.ComputeEdges();
 //    //mesh.ComputeNormals();
 //    mesh.NormalAveragingMode = meshNormalAveragingType.AveragedByAngle;
 //    mesh.EntityData = s;
 //    mesh.Selectable = false;
 //    return mesh;
 //}
 //static public Point3D[] GetMeshPoints(ISurface s, int ROWS, int COLS)
 //{
 //    double[,] uvLim = new double[2, 2];
 //    uvLim[0, 0] = uvLim[1, 0] = 0;
 //    uvLim[0, 1] = uvLim[1, 1] = 1;
 //    return GetExtensionPoints(s, ROWS, COLS, uvLim);
 //    //double[] uv = new double[2], xyz = new double[3];
 //    //Point3D[] d = new Point3D[ROWS * COLS];
 //    //int i = 0;
 //    //for (int iU = 0; iU < ROWS; iU++)
 //    //{
 //    //	uv[0] = (double)iU / (double)(ROWS - 1);
 //    //	for (int iV = 0; iV < COLS; iV++, i++)
 //    //	{
 //    //		uv[1] = (double)iV / (double)(COLS - 1);
 //    //		xVal(uv, ref xyz);
 //    //		d[i].X = xyz[0];
 //    //		d[i].Y = xyz[1];
 //    //		d[i].Z = xyz[2];
 //    //	}
 //    //}
 //    //return d;
 //}
 /// <summary>
 /// Creates a regular grid of 3dpoints from the Surface on the specified uv-interval 
 /// </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 Point3D[] GetExtensionPoints(ISurface s, int ROWS, int COLS, double[,] uvLim)
 {
     //	double[,] uvLim = new double[2, 2];
     //	uvLim[0, 0] = uvLim[1, 0] = 0;
     //	uvLim[0, 1] = uvLim[1, 1] = 1;
     if( uvLim == null )
         uvLim = new double[,]{ { 0, 1 }, {0, 1} };
     Vect2 uv = new Vect2();
     Vect3 xyz = new Vect3();
     Point3D[] d = new Point3D[ROWS * COLS];
     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]);
         for (int iV = 0; iV < COLS; iV++, i++)
         {
             uv[1] = BLAS.interpolate((double)iV / (double)(COLS - 1), uvLim[1, 1], uvLim[1, 0]);
             s.xVal(uv, ref xyz);
             d[i] = new Point3D();
             Utilities.Vect3ToPoint3D(ref d[i], xyz);
         }
     }
     return d;
 }
开发者ID:GabeTesta,项目名称:Warps,代码行数:84,代码来源:ISurface.cs

示例2: Fit

        double Fit(ISurface cof)
        {
            if( cof == null )
            {
                m_rbfs = null;
                return -1;
            }
            int i, j, k;
            int ROWS =15, COLS =15;

            List<double[]>[] uvxs = new List<double[]>[3];
            for(i =0; i<3;i++ )
                uvxs[i] = new List<double[]>(ROWS*COLS);

            Vect2 uv = new Vect2();
            Vect3 xyz = new Vect3();
            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.xVal(uv, ref xyz);
                    for( k =0; k<3;k++ )
                        uvxs[k].Add(new double[]{ uv[0], uv[1], xyz[k]});
                }
            }
            for (i = 0; i < 3; i++)
                m_rbfs[i] = new RBFSurface(uvxs[i]);

            return m_error = CheckError(cof);
        }
开发者ID:GabeTesta,项目名称:Warps,代码行数:32,代码来源:RBFMould.cs


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