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


C# MeshGeometry3D.ToWireframe方法代码示例

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


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

示例1: CreateMesh


//.........这里部分代码省略.........
              point3DCollection.Add(new Point3D(m_min.X, m_min.Y, m_max.Z));
              point3DCollection.Add(new Point3D(m_min.X, m_min.Y, m_min.Z));
              point3DCollection.Add(new Point3D(m_min.X, m_max.Y, m_min.Z));
              point3DCollection.Add(new Point3D(m_min.X, m_max.Y, m_max.Z));
              //Right
              point3DCollection.Add(new Point3D(m_max.X, m_min.Y, m_max.Z));
              point3DCollection.Add(new Point3D(m_max.X, m_min.Y, m_min.Z));
              point3DCollection.Add(new Point3D(m_max.X, m_max.Y, m_min.Z));
              point3DCollection.Add(new Point3D(m_max.X, m_max.Y, m_max.Z));
              //Bottom
              point3DCollection.Add(new Point3D(m_min.X, m_min.Y, m_max.Z));
              point3DCollection.Add(new Point3D(m_max.X, m_min.Y, m_max.Z));
              point3DCollection.Add(new Point3D(m_max.X, m_min.Y, m_min.Z));
              point3DCollection.Add(new Point3D(m_min.X, m_min.Y, m_min.Z));
              //Top
              point3DCollection.Add(new Point3D(m_min.X, m_max.Y, m_max.Z));
              point3DCollection.Add(new Point3D(m_max.X, m_max.Y, m_max.Z));
              point3DCollection.Add(new Point3D(m_max.X, m_max.Y, m_min.Z));
              point3DCollection.Add(new Point3D(m_min.X, m_max.Y, m_min.Z));

              Vector3DCollection normals = new Vector3DCollection();
              normals.Add(new Vector3D(0, 0, 1));
              normals.Add(new Vector3D(0, 0, 1));
              normals.Add(new Vector3D(0, 0, 1));
              normals.Add(new Vector3D(0, 0, 1));

              normals.Add(new Vector3D(0, 0, -1));
              normals.Add(new Vector3D(0, 0, -1));
              normals.Add(new Vector3D(0, 0, -1));
              normals.Add(new Vector3D(0, 0, -1));

              normals.Add(new Vector3D(-1, 0, 0));
              normals.Add(new Vector3D(-1, 0, 0));
              normals.Add(new Vector3D(-1, 0, 0));
              normals.Add(new Vector3D(-1, 0, 0));

              normals.Add(new Vector3D(1, 0, 0));
              normals.Add(new Vector3D(1, 0, 0));
              normals.Add(new Vector3D(1, 0, 0));
              normals.Add(new Vector3D(1, 0, 0));

              normals.Add(new Vector3D(0, -1, 0));
              normals.Add(new Vector3D(0, -1, 0));
              normals.Add(new Vector3D(0, -1, 0));
              normals.Add(new Vector3D(0, -1, 0));

              normals.Add(new Vector3D(0, 1, 0));
              normals.Add(new Vector3D(0, 1, 0));
              normals.Add(new Vector3D(0, 1, 0));
              normals.Add(new Vector3D(0, 1, 0));

              Int32Collection triangles = new Int32Collection();

              //for (int i = 1; i < 6; i += 2)
              //{
              //  triangles.Add(0 + (i * 4));
              //  triangles.Add(1 + (i * 4));
              //  triangles.Add(3 + (i * 4));
              //  triangles.Add(1 + (i * 4));
              //  triangles.Add(2 + (i * 4));
              //  triangles.Add(3 + (i * 4));
              //}

              //for (int i = 0; i < 6; i += 2)
              //{
              //  triangles.Add(3 + (i * 4));
              //  triangles.Add(1 + (i * 4));
              //  triangles.Add(0 + (i * 4));
              //  triangles.Add(3 + (i * 4));
              //  triangles.Add(2 + (i * 4));
              //  triangles.Add(1 + (i * 4));
              //}

              for (int i = 0; i < 6; i++)
              {
            triangles.Add(0 + (i * 4));
            triangles.Add(1 + (i * 4));
            triangles.Add(0 + (i * 4));
            triangles.Add(1 + (i * 4));
            triangles.Add(2 + (i * 4));
            triangles.Add(1 + (i * 4));
            triangles.Add(2 + (i * 4));
            triangles.Add(3 + (i * 4));
            triangles.Add(2 + (i * 4));
            triangles.Add(3 + (i * 4));
            triangles.Add(0 + (i * 4));
            triangles.Add(3 + (i * 4));
              }

              MeshGeometry3D meshGeometry3D = new MeshGeometry3D
            {
              Positions = point3DCollection,
              Normals = normals,
              TriangleIndices = triangles
            };

              m_geometryModel3D = new GeometryModel3D();
              GeometryModel3D.Geometry = meshGeometry3D.ToWireframe(0.1);
              GeometryModel3D.Material = new DiffuseMaterial(new SolidColorBrush(m_color));
        }
开发者ID:grarup,项目名称:SharpE,代码行数:101,代码来源:BoundaryBox.cs


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