本文整理汇总了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;
}
示例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);
}