本文整理汇总了C#中HelixToolkit.Wpf.MeshBuilder.Scale方法的典型用法代码示例。如果您正苦于以下问题:C# MeshBuilder.Scale方法的具体用法?C# MeshBuilder.Scale怎么用?C# MeshBuilder.Scale使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HelixToolkit.Wpf.MeshBuilder
的用法示例。
在下文中一共展示了MeshBuilder.Scale方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateModel
private Model3D CreateModel()
{
// if (Points ==null)
var plotModel = new Model3DGroup();
int rows = Points.GetUpperBound(0) + 1;
int columns = Points.GetUpperBound(1) + 1;
double minX = double.MaxValue;
double maxX = double.MinValue;
double minY = double.MaxValue;
double maxY = double.MinValue;
double minZ = double.MaxValue;
double maxZ = double.MinValue;
//double RealminX = double.MaxValue;
//double RealmaxX = double.MinValue;
//double RealminY = double.MaxValue;
//double RealmaxY = double.MinValue;
//double RealminZ = double.MaxValue;
//double RealmaxZ = double.MinValue;
#region Color things
double minColorValue = double.MaxValue;
double maxColorValue = double.MinValue;
for (int i = 0; i < rows; i++)
for (int j = 0; j < columns; j++)
{
double x = Points[i, j].X;
double y = Points[i, j].Y;
double z = Points[i, j].Z;
maxX = Math.Max(maxX, x);
maxY = Math.Max(maxY, y);
maxZ = Math.Max(maxZ, z);
minX = Math.Min(minX, x);
minY = Math.Min(minY, y);
minZ = Math.Min(minZ, z);
if (ColorValues != null)
{
maxColorValue = Math.Max(maxColorValue, ColorValues[i, j]);
minColorValue = Math.Min(minColorValue, ColorValues[i, j]);
}
}
// make color value 0 at texture coordinate 0.5
if (Math.Abs(minColorValue) < Math.Abs(maxColorValue))
minColorValue = -maxColorValue;
else
maxColorValue = -minColorValue;
#endregion
// set the texture coordinates by z-value or ColorValue
var texcoords = new Point[rows,columns];
if (OriginalData == null || ColorCoding != ComplexPlainVisualizer.ColorCoding.Custom)
{
for (int i = 0; i < rows; i++)
for (int j = 0; j < columns; j++)
{
double u = (Points[i, j].Z - minZ) / (maxZ - minZ);
//double v =
if (ColorValues != null)
u = (ColorValues[i, j] - minColorValue) / (maxColorValue - minColorValue);
texcoords[i, j] = new Point(u, u);
}
}
else
{
for (int i = 0; i < rows; i++)
for (int j = 0; j < columns; j++)
{
double u = MathUtil.Scale(minZ, maxZ, Math.Log10(OriginalData[i, j].Z), 0.5);
double v = OriginalData[i, j].W;
double uu = 0.5 + u * Math.Cos(v);
double vv = 0.5 + u * Math.Sin(v);
texcoords[i, j] = new Point(uu, vv);
}
}
if (AutoScale)
{
ScaleX =10 / Math.Abs(maxX - minX);
ScaleY =10/ Math.Abs(maxY - minY);
ScaleZ =5 / Math.Abs(maxZ - minZ);
}
var surfaceMeshBuilder = new MeshBuilder();
surfaceMeshBuilder.AddRectangularMesh(Points, texcoords);
surfaceMeshBuilder.Scale(ScaleX, ScaleY, ScaleZ);
var surfaceModel = new GeometryModel3D(surfaceMeshBuilder.ToMesh(),
MaterialHelper.CreateMaterial(SurfaceBrush, null, null, 1, 0));
surfaceModel.BackMaterial = surfaceModel.Material;
//RealmaxX = maxX;
//RealminX = minX;
//.........这里部分代码省略.........
示例2: Tessellate
/// <summary>
/// The tessellate.
/// </summary>
/// <returns>The mesh.</returns>
protected override MeshGeometry3D Tessellate()
{
var builder = new MeshBuilder(false, true);
builder.AddSphere(new Point3D(0, 0, 0), 1.0, this.ThetaDiv, this.PhiDiv);
builder.Scale(this.RadiusX, this.RadiusY, this.RadiusZ);
return builder.ToMesh();
}