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


C# MeshBuilder.Scale方法代码示例

本文整理汇总了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;
//.........这里部分代码省略.........
开发者ID:gaesquivel,项目名称:Simulador-de-Circuitos,代码行数:101,代码来源:SurfacePlotVisual3D.cs

示例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();
 }
开发者ID:BEEden,项目名称:Diplomarbeit,代码行数:11,代码来源:EllipsoidVisual3D.cs


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