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


C# Mesh.GetBoundingBox方法代码示例

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


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

示例1: DrawBlueMeshConduit

 public DrawBlueMeshConduit(Mesh mesh)
 {
     // set up as much data as possible so we do the minimum amount of work possible inside
     // the actual display code
     m_mesh = mesh;
     m_color = System.Drawing.Color.Blue;
     m_material = new DisplayMaterial();
     m_material.Diffuse = m_color;
     if (m_mesh != null && m_mesh.IsValid)
       m_bbox = m_mesh.GetBoundingBox(true);
 }
开发者ID:acormier,项目名称:RhinoCommonExamples,代码行数:11,代码来源:ex_drawmesh.cs

示例2: GetStepTree

        DataTree<Object> GetStepTree(Mesh terrainMesh, List<double> contourZList, DataTree<Curve> contourTree, List<Brep> brepList)
        {
            DataTree<Object> stepTree = new DataTree<Object>();
            Plane basePlane = Plane.WorldXY;
            basePlane.OriginZ = terrainMesh.GetBoundingBox(true).Min.Z;

            // For each contour-plane
            for (int i = 0; i < contourTree.BranchCount; i++)
            {

                // create higher-Z pt list
                Point3dList winPtList = new Point3dList();

                foreach (Curve contourCrv in contourTree.Branches[i])
                {

                    Plane frm;
                    double t;
                    contourCrv.NormalizedLengthParameter(0.5, out t);
                    contourCrv.FrameAt(t, out frm);
                    frm.Transform(Rhino.Geometry.Transform.PlanarProjection(basePlane));

                    Point3d samplePt0, samplePt1;
                    samplePt0 = frm.Origin;
                    samplePt1 = frm.Origin;
                    samplePt0 += doc.ModelAbsoluteTolerance * frm.YAxis;
                    samplePt1 -= doc.ModelAbsoluteTolerance * frm.YAxis;
                    Ray3d ray0 = new Ray3d(samplePt0, Vector3d.ZAxis);
                    Ray3d ray1 = new Ray3d(samplePt1, Vector3d.ZAxis);
                    double rayParam0 = Rhino.Geometry.Intersect.Intersection.MeshRay(terrainMesh, ray0);
                    double rayParam1 = Rhino.Geometry.Intersect.Intersection.MeshRay(terrainMesh, ray1);

                    winPtList.Add(((rayParam0 > rayParam1) ? samplePt0 : samplePt1));
                }

                // For each splitted region in contour-plane
                foreach (BrepFace brepFace in brepList[i].Faces)
                {
                    Brep testBrep = brepFace.DuplicateFace(false);

                    foreach (Point3d pt in winPtList)
                    {

                        LineCurve testRay = new LineCurve(new Line(pt, Vector3d.ZAxis, 1000));
                        Point3d[] outPts;
                        Curve[] outCrvs;

                        bool ix = Rhino.Geometry.Intersect.Intersection.CurveBrep(testRay, testBrep, doc.ModelAbsoluteTolerance, out outCrvs, out outPts);
                        if (outPts.Length != 0)
                        {
                            stepTree.Add(testBrep, new GH_Path(i));
                            break;
                        }
                    }
                }
            }

            return stepTree;
        }
开发者ID:parkjunseok,项目名称:Beaver,代码行数:59,代码来源:Beaver.Terrain.cs

示例3: GetContourZList

        List<double> GetContourZList(Mesh mesh, double contourBaseZ, double contourInterval)
        {
            List<double> levelList = new List<double>();
            Rhino.Geometry.BoundingBox bbox = mesh.GetBoundingBox(true);
            int n1 = (int)Math.Ceiling((bbox.Min.Z - contourBaseZ) / contourInterval);
            int n2 = (int)Math.Floor((bbox.Max.Z - contourBaseZ) / contourInterval);

            for (int i = n1; i <= n2; i++)
            {
                levelList.Add(contourBaseZ + i * contourInterval);
            }

            return levelList;
        }
开发者ID:parkjunseok,项目名称:Beaver,代码行数:14,代码来源:Beaver.Terrain.cs

示例4: CreateBlades

        private void CreateBlades()
        {
            var xInterval = new Interval(-Settings.GameBoardWith / 2d - Settings.BladeSize.X / 2, -Settings.GameBoardWith / 2d + Settings.BladeSize.X / 2);
            var yInterval = new Interval(-Settings.BladeSize.Y / 2, Settings.BladeSize.Y / 2);
            var zInterval = new Interval(-Settings.BladeSize.Z / 2, Settings.BladeSize.Z / 2);

            _bladeLeft = Mesh.CreateFromBox(new Box(Plane.WorldXY, xInterval, yInterval, zInterval), 1, 1, 1);
            _bladeRight = _bladeLeft.DuplicateMesh();
            _bladeRight.Translate(new Vector3d(Settings.GameBoardWith, 0, 0));

            _bladeLeftInitialPosition = _bladeLeft.GetBoundingBox(true).Center;
            _bladeRightInitialPosition = _bladeRight.GetBoundingBox(true).Center;

            _bladeLeftPosition = new Point3d(_bladeLeftInitialPosition);
            _bladeRightPosition = new Point3d(_bladeRightInitialPosition);

            _bladeTransformLetft = Transform.Identity;
            _bladeTransformRight = Transform.Identity;
            _ballTransform = Transform.Identity;
        }
开发者ID:samuto,项目名称:Rhino-Pong,代码行数:20,代码来源:Game.cs

示例5: Mesh3DMinimalBox

 public Mesh Mesh3DMinimalBox(Mesh mesh)
 {
     List<Point3d> x = new List<Point3d>();
     Rhino.Geometry.Collections.MeshTopologyVertexList vs = mesh.TopologyVertices;
     for (int i = 0; i < vs.Count; i++)
     {
         x.Add(new Point3d(vs[i]));
     }
     Mesh mesh2 = ch.ConvexHull(x);
     mesh2.Faces.ConvertQuadsToTriangles();
     double t = double.MaxValue;
     Transform xform = new Transform();
     for (int i = 0; i < mesh2.Faces.Count - 1; i++)
     {
         Point3d p1 = new Point3d(mesh2.Vertices[mesh2.Faces[i].A]);
         Point3d p2 = new Point3d(mesh2.Vertices[mesh2.Faces[i].B]);
         Point3d p3 = new Point3d(mesh2.Vertices[mesh2.Faces[i].C]);
         Plane p = new Plane(p1, p2, p3);
         Mesh mesh3 = new Mesh(); mesh3.Append(mesh);
         mesh3.Transform(Transform.PlaneToPlane(p, Plane.WorldXY));
         Rhino.Geometry.BoundingBox box = mesh3.GetBoundingBox(true);
         double area = (box.Max.X - box.Min.X) * (box.Max.Y - box.Min.Y) * (box.Max.Z - box.Min.Z);
         if (area < t) { t = area; xform = Transform.PlaneToPlane(p, Plane.WorldXY); }
     }
     mesh.Transform(xform);
     return mesh;
 }
开发者ID:panhao4812,项目名称:MeshClassLibrary,代码行数:27,代码来源:MeshUnfold.cs

示例6: Drawface2D

 private void Drawface2D(Mesh x, float t)
 {
     BoundingBox box = x.GetBoundingBox(true);
     Point3d cen = box.Center;
     OpenTK.Graphics.OpenGL.GL.Begin(OpenTK.Graphics.OpenGL.PrimitiveType.Triangles);
     for(int i = 0;i < x.Faces.Count;i++){
       MeshFace f = x.Faces[i];
       if(f.IsTriangle){
     Point3f p1 = x.Vertices[f.A];  Point3f p2 = x.Vertices[f.B];  Point3f p3 = x.Vertices[f.C];
     OpenTK.Graphics.OpenGL.GL.Color3(x.VertexColors[f.A]);
     OpenTK.Graphics.OpenGL.GL.Vertex2((p1.X - cen.X) * t, (p1.Y - cen.Y) * t);
     OpenTK.Graphics.OpenGL.GL.Color3(x.VertexColors[f.B]);
     OpenTK.Graphics.OpenGL.GL.Vertex2((p2.X - cen.X) * t, (p2.Y - cen.Y) * t);
     OpenTK.Graphics.OpenGL.GL.Color3(x.VertexColors[f.C]);
     OpenTK.Graphics.OpenGL.GL.Vertex2((p3.X - cen.X) * t, (p3.Y - cen.Y) * t);
       }
     }
     OpenTK.Graphics.OpenGL.GL.End();
     OpenTK.Graphics.OpenGL.GL.Begin(OpenTK.Graphics.OpenGL.PrimitiveType.Quads);
     for(int i = 0;i < x.Faces.Count;i++){
       MeshFace f = x.Faces[i];
       if(f.IsQuad){
     Point3f p1 = x.Vertices[f.A];  Point3f p2 = x.Vertices[f.B];
     Point3f p3 = x.Vertices[f.C];   Point3f p4 = x.Vertices[f.D];
     OpenTK.Graphics.OpenGL.GL.Color3(x.VertexColors[f.A]);
     OpenTK.Graphics.OpenGL.GL.Vertex2((p1.X - cen.X) * t, (p1.Y - cen.Y) * t);
     OpenTK.Graphics.OpenGL.GL.Color3(x.VertexColors[f.B]);
     OpenTK.Graphics.OpenGL.GL.Vertex2((p2.X - cen.X) * t, (p2.Y - cen.Y) * t);
     OpenTK.Graphics.OpenGL.GL.Color3(x.VertexColors[f.C]);
     OpenTK.Graphics.OpenGL.GL.Vertex2((p3.X - cen.X) * t, (p3.Y - cen.Y) * t);
     OpenTK.Graphics.OpenGL.GL.Color3(x.VertexColors[f.D]);
     OpenTK.Graphics.OpenGL.GL.Vertex2((p4.X - cen.X) * t, (p4.Y - cen.Y) * t);
       }
     }
     OpenTK.Graphics.OpenGL.GL.End();
 }
开发者ID:panhao4812,项目名称:MaterialTools,代码行数:36,代码来源:openTK2.cs

示例7: IsPtInMesh

 private bool IsPtInMesh(Point3d point, Mesh mesh)
 {
     mesh.FaceNormals.ComputeFaceNormals();
     mesh.UnifyNormals();
     mesh.Normals.ComputeNormals();
     BoundingBox boundingBox = mesh.GetBoundingBox(true);
     if (!boundingBox.Contains(point))
     {
         return false;
     }
     Polyline points = new Polyline();
     points.Add(point);
     Vector3d vectord = new Vector3d(100.0, 100.0, 100.0);
     points.Add(boundingBox.Max + vectord);
     int[] faceIds = null;
     Point3d[] pointdArray = Rhino.Geometry.Intersect.Intersection.MeshPolyline(mesh, new PolylineCurve(points), out faceIds);
     if (pointdArray == null)
     {
         return false;
     }
     if ((pointdArray.Length % 2) == 0)
     {
         return false;
     }
     return true;
 }
开发者ID:panhao4812,项目名称:MeshClassLibrary,代码行数:26,代码来源:MeshConvexHull.cs


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