Пример #1
0
        public static DMesh3 PlanarFill(DMesh3 mesh, EdgeLoop loop, double eLen)
        {
            PlanarHoleFiller holeFiller = new PlanarHoleFiller(mesh);

            holeFiller.AddFillLoop(loop);

            Plane.FitPlaneToPoints(loop.Vertices.Select(ind => mesh.GetVertex(ind).ToRhinoPt()), out Plane pl);

            holeFiller.SetPlane(pl.Origin.ToVec3d(), pl.ZAxis.ToVec3d());

            holeFiller.FillTargetEdgeLen = eLen;

            holeFiller.Fill();

            return(holeFiller.Mesh);
        }
Пример #2
0
        bool fill_planar()
        {
            Vector3d n = Vector3d.Zero, c = Vector3d.Zero;
            int      NE = FillLoop.EdgeCount;

            for (int k = 0; k < NE; ++k)
            {
                int eid = FillLoop.Edges[k];
                n += Mesh.GetTriNormal(Mesh.GetEdgeT(eid).a);
                c += Mesh.GetEdgePoint(eid, 0.5);
            }
            n.Normalize(); c /= (double)NE;

            var filler = new PlanarHoleFiller(Mesh);

            filler.FillTargetEdgeLen = TargetEdgeLength;
            filler.AddFillLoop(FillLoop);
            filler.SetPlane(c, n);

            bool bOK = filler.Fill();

            return(bOK);
        }