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


C# MeshBuilder.AddCylinder方法代码示例

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


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

示例1: UpdateVisuals

        /// <summary>
        /// Updates the visuals.
        /// </summary>
        protected void UpdateVisuals()
        {
            if (this.Mesh == null)
            {
                this.Content = null;
                return;
            }

            var m = new Model3DGroup();

            this.TriangleIndexToFaceIndex = new List<int>();
            var faceGeometry = this.Mesh.ToMeshGeometry3D(
                this.SharedVertices, this.ShrinkFactor, this.TriangleIndexToFaceIndex);
            m.Children.Add(
                new GeometryModel3D(faceGeometry, this.FaceMaterial) { BackMaterial = this.FaceBackMaterial });

            // Add the nodes
            if (this.VertexRadius > 0)
            {
                var gm = new MeshBuilder(false, false);
                foreach (var p in this.Mesh.Vertices)
                {
                    gm.AddSubdivisionSphere(p, this.VertexRadius, this.VertexResolution);

                    // gm.AddBox(p, VertexRadius, VertexRadius, VertexRadius);
                }

                m.Children.Add(new GeometryModel3D(gm.ToMesh(), this.VertexMaterial));
            }

            // Add the edges
            if (this.EdgeDiameter > 0)
            {
                var em = new MeshBuilder(false, false);
                //// int fi = 0;
                foreach (var p in this.Mesh.Faces)
                {
                    //// var n = this.Mesh.GetFaceNormal(fi++);
                    for (int i = 0; i < p.Length; i += 1)
                    {
                        var p0 = this.Mesh.Vertices[p[i]];
                        var p1 = this.Mesh.Vertices[p[(i + 1) % p.Length]];
                        em.AddCylinder(p0, p1, this.EdgeDiameter, 4);
                    }
                }

                m.Children.Add(new GeometryModel3D(em.ToMesh(), this.EdgeMaterial));
            }

            this.Content = m;
        }
开发者ID:chantsunman,项目名称:helix-toolkit,代码行数:54,代码来源:MeshVisual3D.cs

示例2: AppearanceChanged

        private void AppearanceChanged()
        {
            var builder = new MeshBuilder(false, false);
            foreach (var p1 in DistributePoles(this.Positions, this.PoleDistance))
            {
                var p2 = p1 + new Vector3D(0, 0, this.Height);
                builder.AddCylinder(p1, p2, this.Diameter, 36);
            }

            this.postsModel.Geometry = builder.ToMesh();

            var fenceBuilder = new MeshBuilder(false, true);
            var w0 = 0d;
            for (int i = 0; i + 1 < this.Positions.Count; i++)
            {
                var p0 = this.Positions[i];
                var p1 = this.Positions[i + 1];
                var p2 = this.Positions[i + 1] + new Vector3D(0, 0, this.Height);
                var p3 = this.Positions[i] + new Vector3D(0, 0, this.Height);
                var h = this.Height / this.MeshSize;
                var dw = p0.DistanceTo(p1) / this.MeshSize;
                fenceBuilder.AddQuad(
                    p0,
                    p1,
                    p2,
                    p3,
                    new Point(w0, h),
                    new Point(w0 + dw, h),
                    new Point(w0 + dw, 0),
                    new Point(w0, 0));
                w0 += dw;
            }

            this.fenceModel.Geometry = fenceBuilder.ToMesh();
        }
开发者ID:chantsunman,项目名称:helix-toolkit,代码行数:35,代码来源:FenceVisual3D.cs


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