本文整理汇总了C#中System.Windows.Media.Media3D.Point3D.GetUpperBound方法的典型用法代码示例。如果您正苦于以下问题:C# Point3D.GetUpperBound方法的具体用法?C# Point3D.GetUpperBound怎么用?C# Point3D.GetUpperBound使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Media.Media3D.Point3D
的用法示例。
在下文中一共展示了Point3D.GetUpperBound方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FindGradientY
// http://en.wikipedia.org/wiki/Numerical_differentiation
public double[,] FindGradientY(Point3D[,] data)
{
int n = data.GetUpperBound(0) + 1;
int m = data.GetUpperBound(0) + 1;
var K = new double[n, m];
for (int i = 0; i < n; i++)
for (int j = 0; j < m; j++)
{
// Finite difference approximation
var p10 = data[i + 1 < n ? i + 1 : i, j - 1 > 0 ? j - 1 : j];
var p00 = data[i - 1 > 0 ? i - 1 : i, j - 1 > 0 ? j - 1 : j];
var p11 = data[i + 1 < n ? i + 1 : i, j + 1 < m ? j + 1 : j];
var p01 = data[i - 1 > 0 ? i - 1 : i, j + 1 < m ? j + 1 : j];
//double dx = p01.X - p00.X;
//double dz = p01.Z - p00.Z;
//double Fx = dz / dx;
double dy = p10.Y - p00.Y;
double dz = p10.Z - p00.Z;
K[i, j] = dz / dy;
}
return K;
}
示例2: BilinearInterpolation
private static Point3D BilinearInterpolation(Point3D[,] p, double i, double j)
{
int n = p.GetUpperBound(0);
int m = p.GetUpperBound(1);
var i0 = (int) i;
var j0 = (int) j;
if (i0 + 1 >= n) i0 = n - 2;
if (j0 + 1 >= m) j0 = m - 2;
if (i < 0) i = 0;
if (j < 0) j = 0;
double u = i - i0;
double v = j - j0;
Vector3D v00 = p[i0, j0].ToVector3D();
Vector3D v01 = p[i0, j0 + 1].ToVector3D();
Vector3D v10 = p[i0 + 1, j0].ToVector3D();
Vector3D v11 = p[i0 + 1, j0 + 1].ToVector3D();
Vector3D v0 = v00*(1 - u) + v10*u;
Vector3D v1 = v01*(1 - u) + v11*u;
return (v0*(1 - v) + v1*v).ToPoint3D();
}
示例3: AddRectangularMesh
/// <summary>
/// Adds a rectangular mesh defined by a two-dimensional array of points.
/// </summary>
/// <param name="points">
/// The points.
/// </param>
/// <param name="texCoords">
/// The texture coordinates (optional).
/// </param>
/// <param name="closed0">
/// set to <c>true</c> if the mesh is closed in the first dimension.
/// </param>
/// <param name="closed1">
/// set to <c>true</c> if the mesh is closed in the second dimension.
/// </param>
public void AddRectangularMesh(
Point3D[,] points, Point[,] texCoords = null, bool closed0 = false, bool closed1 = false)
{
if (points == null)
{
throw new ArgumentNullException("points");
}
int rows = points.GetUpperBound(0) + 1;
int columns = points.GetUpperBound(1) + 1;
int index0 = this.positions.Count;
for (int i = 0; i < rows; i++)
{
for (int j = 0; j < columns; j++)
{
this.positions.Add(points[i, j]);
}
}
this.AddRectangularMeshTriangleIndices(index0, rows, columns, closed0, closed1);
if (this.normals != null)
{
this.AddRectangularMeshNormals(index0, rows, columns);
}
if (this.textureCoordinates != null)
{
if (texCoords != null)
{
for (int i = 0; i < rows; i++)
{
for (int j = 0; j < columns; j++)
{
this.textureCoordinates.Add(texCoords[i, j]);
}
}
}
else
{
this.AddRectangularMeshTextureCoordinates(rows, columns);
}
}
}
示例4: AddRectangularMesh
/// <summary>
/// Adds a rectangular mesh defined by a two-dimensional arrary of points.
/// </summary>
/// <param name="pts">The points.</param>
/// <param name="closed0">set to <c>true</c> if the mesh is closed in the 1st dimension.</param>
/// <param name="closed1">set to <c>true</c> if the mesh is closed in the 2nd dimension.</param>
public void AddRectangularMesh(Point3D[,] pts, bool closed0, bool closed1)
{
int rows = pts.GetUpperBound(0) + 1;
int columns = pts.GetUpperBound(1) + 1;
int index0 = positions.Count;
for (int i = 0; i < rows; i++)
for (int j = 0; j < columns; j++)
positions.Add(pts[i, j]);
AddRectangularMeshTriangleIndices(index0, rows, columns, closed0, closed1);
if (normals != null)
{
AddRectangularMeshNormals(index0, rows, columns);
}
if (textureCoordinates != null)
{
AddRectangularMeshTextureCoordinates(rows, columns);
}
}
示例5: FindGradientZ
//public double[,] CreatePatternGradient(Point4D[,] data)
//{
// double minZ = double.MaxValue;
// double maxZ = double.MinValue;
// //double minW = double.MaxValue;
// //double maxW = double.MinValue;
// int n = data.GetUpperBound(0) + 1;
// int m = data.GetUpperBound(0) + 1;
// for (int i = 0; i < n; i++)
// for (int j = 0; j < m; j++)
// {
// double z = data[i, j].Z;
// double w = data[i, j].W;
// maxZ = Math.Max(maxZ, z);
// minZ = Math.Min(minZ, z);
// //maxW = Math.Max(maxW, w);
// //minW = Math.Min(minW, w);
// }
// var K = new double[n, m];
// for (int i = 0; i < n; i++)
// for (int j = 0; j < m; j++)
// {
// double mod = MathUtil.Scale(minZ, maxZ, data[i, j].Z, 100, 0);
// double fas = data[i, j].W; //MathUtil.Scale(0, 2 * Math.PI, data[i, j].W);
// K[i, j] = i + j; //0.5 + mod + fas;//* Math.Cos(fas);
// }
// return K;
//}
public double[,] FindGradientZ(Point3D[,] data, int offset = 0)
{
double minZ = double.MaxValue;
double maxZ = double.MinValue;
int n = data.GetUpperBound(0) + 1;
int m = data.GetUpperBound(0) + 1;
for (int i = 0; i < n; i++)
for (int j = 0; j < m; j++)
{
double z = data[i, j].Z;
maxZ = Math.Max(maxZ, z);
minZ = Math.Min(minZ, z);
}
var K = new double[n, m];
for (int i = 0; i < n; i++)
for (int j = 0; j < m; j++)
{
K[i, j] = MathUtil.Scale(minZ, maxZ, data[i, j].Z, n);
}
return K;
}