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


C# MeshBuilder.AddPyramid方法代码示例

本文整理汇总了C#中HelixToolkit.Wpf.MeshBuilder.AddPyramid方法的典型用法代码示例。如果您正苦于以下问题:C# MeshBuilder.AddPyramid方法的具体用法?C# MeshBuilder.AddPyramid怎么用?C# MeshBuilder.AddPyramid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在HelixToolkit.Wpf.MeshBuilder的用法示例。


在下文中一共展示了MeshBuilder.AddPyramid方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AddGeometry

        GeometryModel3D AddGeometry(IEnumerable<Point3D> centers, double l)
        {
            var builder = new MeshBuilder();

            foreach (var center in centers)
            {
                builder.AddPyramid(center, l, l, true);
            }

            var mv = new GeometryModel3D
                             {
                                 Geometry = builder.ToMesh(true),
                                 Material = MaterialHelper.CreateMaterial(Brushes.Gold)
                             };

            TriangleCount = builder.TriangleIndices.Count / 3;

            return mv;
        }
开发者ID:helix-toolkit,项目名称:helix-toolkit,代码行数:19,代码来源:SierpinskiPyramid.cs

示例2: AddPyramid

        /// <summary>
        /// Add a pyramid geometry object pointing up with base centred at (0,0,0).
        /// </summary>
        /// <param name="shapeName">The 3DView object.</param>
        /// <param name="sideLength">The radius of the base.</param>
        /// <param name="height">The height of the cone.</param>
        /// <param name="colour">A colour or gradient brush for the object.</param>
        /// <param name="materialType">A material for the object.
        /// The available options are:
        /// "E" Emmissive - constant brightness.
        /// "D" Diffusive - affected by lights.
        /// "S" Specular  - specular highlights.
        /// </param>
        /// <returns>The 3DView Geometry name.</returns>
        public static Primitive AddPyramid(Primitive shapeName, Primitive sideLength, Primitive height, Primitive colour, Primitive materialType)
        {
            UIElement obj;

            try
            {
                if (_objectsMap.TryGetValue((string)shapeName, out obj))
                {
                    InvokeHelperWithReturn ret = new InvokeHelperWithReturn(delegate
                    {
                        try
                        {
                            if (obj.GetType() == typeof(Viewport3D))
                            {
                                MeshBuilder builder = new MeshBuilder(true, true);
                                builder.AddPyramid(new Point3D(0, 0, 0), sideLength, height);
                                MeshGeometry3D mesh = builder.ToMesh();

                                Viewport3D viewport3D = (Viewport3D)obj;
                                return AddGeometry(viewport3D, mesh.Positions, mesh.TriangleIndices, mesh.Normals, mesh.TextureCoordinates, colour, materialType);
                            }
                        }
                        catch (Exception ex)
                        {
                            Utilities.OnError(Utilities.GetCurrentMethod(), ex);
                        }
                        return "";
                    });
                    return FastThread.InvokeWithReturn(ret).ToString();
                }
                else
                {
                    Utilities.OnShapeError(Utilities.GetCurrentMethod(), shapeName);
                }
            }
            catch (Exception ex)
            {
                Utilities.OnError(Utilities.GetCurrentMethod(), ex);
            }
            return "";
        }
开发者ID:litdev1,项目名称:LitDev,代码行数:55,代码来源:3DView.cs


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