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