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


C# MeshBuilder.AddCircleInZCross方法代码示例

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


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

示例1: CreateModel


//.........这里部分代码省略.........
            {
                // draw faces in z directions
                mb = new MeshBuilder();
                mb.AddRectangularMesh(
                    new[] {
                        new Point3D(rectDraw.X,rectDraw.Y,rectDraw.Z),                          //0,0,0
                        new Point3D(rectDraw.X+rectDraw.SizeX,rectDraw.Y,rectDraw.Z),                      //1,0,0
                        new Point3D(rectDraw.X,rectDraw.Y+rectDraw.SizeY,rectDraw.Z),                      //0,1,0
                        new Point3D(rectDraw.X+rectDraw.SizeX,rectDraw.Y+rectDraw.SizeY,rectDraw.Z)                   //1,1,0
                    }, 2);

                plotModel.Children.Add(new GeometryModel3D(mb.ToMesh(), MaterialHelper.CreateMaterial(znBrush)));

                mb = new MeshBuilder(); mb.AddRectangularMesh(
                    new[] {
                        new Point3D(rectDraw.X,rectDraw.Y+rectDraw.SizeY,rectDraw.Z+rectDraw.SizeZ),                  // 0,1,1
                        new Point3D(rectDraw.X+rectDraw.SizeX,rectDraw.Y+rectDraw.SizeY,rectDraw.Z+rectDraw.SizeZ),              // 1,1,1
                        new Point3D(rectDraw.X,rectDraw.Y,rectDraw.Z+rectDraw.SizeZ),                      // 0,0,1
                        new Point3D(rectDraw.X+rectDraw.SizeX,rectDraw.Y,rectDraw.Z+rectDraw.SizeZ)                   // 1,0,1
                    }
                    , 2);

                plotModel.Children.Add(new GeometryModel3D(mb.ToMesh(), MaterialHelper.CreateMaterial(zpBrush)));

                // draw faces in y directions
                mb = new MeshBuilder();
                mb.AddRectangularMesh(
                    new[] {
                        new Point3D(rectDraw.X,rectDraw.Y,rectDraw.Z),
                        new Point3D(rectDraw.X,rectDraw.Y,rectDraw.Z+rectDraw.SizeZ),
                        new Point3D(rectDraw.X+rectDraw.SizeX,rectDraw.Y,rectDraw.Z),
                        new Point3D(rectDraw.X+rectDraw.SizeX,rectDraw.Y,rectDraw.Z+rectDraw.SizeZ)
                    }, 2);

                plotModel.Children.Add(new GeometryModel3D(mb.ToMesh(), MaterialHelper.CreateMaterial(ynBrush)));

                mb = new MeshBuilder(); mb.AddRectangularMesh(
                    new[] {
                        new Point3D(rectDraw.X+rectDraw.SizeX,rectDraw.Y+rectDraw.SizeY,rectDraw.Z),
                        new Point3D(rectDraw.X+rectDraw.SizeX,rectDraw.Y+rectDraw.SizeY,rectDraw.Z+rectDraw.SizeZ),
                        new Point3D(rectDraw.X,rectDraw.Y+rectDraw.SizeY,rectDraw.Z),
                        new Point3D(rectDraw.X,rectDraw.Y+rectDraw.SizeY,rectDraw.Z+rectDraw.SizeZ)
                    }, 2);

                plotModel.Children.Add(new GeometryModel3D(mb.ToMesh(), MaterialHelper.CreateMaterial(ypBrush)));

                // draw faces in x directions
                mb = new MeshBuilder();
                mb.AddRectangularMesh(
                    new[] {
                        new Point3D(rectDraw.X,rectDraw.Y,rectDraw.Z),
                        new Point3D(rectDraw.X,rectDraw.Y+rectDraw.SizeY,rectDraw.Z),
                        new Point3D(rectDraw.X,rectDraw.Y,rectDraw.Z+rectDraw.SizeZ),
                        new Point3D(rectDraw.X,rectDraw.Y+rectDraw.SizeY,rectDraw.Z+rectDraw.SizeZ)
                    }, 2);

                plotModel.Children.Add(new GeometryModel3D(mb.ToMesh(), MaterialHelper.CreateMaterial(xnBrush)));

                mb = new MeshBuilder(); mb.AddRectangularMesh(
                    new[] {
                        new Point3D(rectDraw.X+rectDraw.SizeX,rectDraw.Y,rectDraw.Z+rectDraw.SizeZ),
                        new Point3D(rectDraw.X+rectDraw.SizeX,rectDraw.Y+rectDraw.SizeY,rectDraw.Z+rectDraw.SizeZ),
                        new Point3D(rectDraw.X+rectDraw.SizeX,rectDraw.Y,rectDraw.Z),
                        new Point3D(rectDraw.X+rectDraw.SizeX,rectDraw.Y+rectDraw.SizeY,rectDraw.Z)
                    }, 2);

                plotModel.Children.Add(new GeometryModel3D(mb.ToMesh(), MaterialHelper.CreateMaterial(xpBrush)));
            }

            if (isCylindarMode)
            {
                int div = 121;
                mb = new MeshBuilder();
                double s = Math.Min(_realRect3D.SizeX, _realRect3D.SizeY);
                double shiftx = (_realRect3D.SizeX - s) / 2;
                double shifty = (_realRect3D.SizeY - s) / 2;
                var startCentre = new Point3D(Centre.X * s + shiftx, Centre.Y * s + shifty, rectDraw.Z);
                var endCentre = new Point3D(Centre.X * s + shiftx, Centre.Y * s + shifty, rectDraw.Z + rectDraw.SizeZ);
                double r = Radius * s;
                mb.AddCylindarZ(startCentre, r, rectDraw.SizeZ, div);
                plotModel.Children.Add(new GeometryModel3D(mb.ToMesh(), MaterialHelper.CreateMaterial(expBrush)));

                mb = new MeshBuilder();

                mb.AddCircleInZCross(startCentre, r, div, false);

                znBrush.Viewbox = new Rect((startCentre.X - r) / _realRect3D.SizeX, (startCentre.Y - r) / _realRect3D.SizeY, (2 * r) / _realRect3D.SizeX, (2 * r) / _realRect3D.SizeY);
                plotModel.Children.Add(new GeometryModel3D(mb.ToMesh(), MaterialHelper.CreateMaterial(znBrush)));

                mb = new MeshBuilder();

                mb.AddCircleInZCross(endCentre, r, div, true);

                zpBrush.Viewbox = new Rect((startCentre.X - r) / _realRect3D.SizeX, (startCentre.Y - r) / _realRect3D.SizeY, (2 * r) / _realRect3D.SizeX, (2 * r) / _realRect3D.SizeY);
                zpBrush.Transform = null;
                plotModel.Children.Add(new GeometryModel3D(mb.ToMesh(), MaterialHelper.CreateMaterial(zpBrush)));
            }

            return plotModel;
        }
开发者ID:woodxiang,项目名称:WpfApplication2,代码行数:101,代码来源:Section3DVisual3D.cs


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