示例#1
0
        public void CloseMesh(List <BoundaryLine> lines, Edge <T> firstCutEdge, CyclicInterval boundaryCount)
        {
            MeshCell <T> cell = firstCutEdge.Cell;

            //Divide this cell
            //================================================================
            //NewVertices
            Vertex[] verticesOfNewRidgeBoundary = new Vertex[lines.Count + 2];
            verticesOfNewRidgeBoundary[0] = firstCutEdge.End;
            verticesOfNewRidgeBoundary[verticesOfNewRidgeBoundary.Length - 1] = mesh.Vertices[cell.IntersectionVertex];
            //Add Vertices of lines
            for (int i = 1; i < verticesOfNewRidgeBoundary.Length - 1; ++i)
            {
                verticesOfNewRidgeBoundary[i] = lines[lines.Count - i].End;
                int ID = mesh.AddVertex(verticesOfNewRidgeBoundary[i]);
            }

            //New Edges
            MeshCell <T> newCell = new MeshCell <T>();

            mesh.AddCell(newCell);
            MeshMethods.CreateBoundaryEdge(
                verticesOfNewRidgeBoundary,
                cell,
                newCell,
                out Edge <T>[] newEdges,
                out Edge <T>[] newNeighborEdges,
示例#2
0
        public Edge <T> Subdivide(Edge <T> edge, List <BoundaryLine> lines, double alpha, CyclicInterval boundaryCount)
        {
            MeshCell <T> cell = edge.Cell;
            //Divide Ridge and update Ridge Arrays
            //-------------------------------------
            Vertex newVertex = DivideEdge(edge, alpha, out Edge <T> newRidge);

            edge.Twin.Cell.IntersectionVertex = newVertex.ID;
            //cell.IntersectionVertex = newVertex.ID;

            //Divide this cell
            //================================================================
            //NewVertices
            Vertex[] verticesOfNewRidgeBoundary = new Vertex[lines.Count + 2];
            verticesOfNewRidgeBoundary[0] = newVertex;
            verticesOfNewRidgeBoundary[verticesOfNewRidgeBoundary.Length - 1] = mesh.Vertices[cell.IntersectionVertex];
            //Add Vertices of lines
            for (int i = 1; i < verticesOfNewRidgeBoundary.Length - 1; ++i)
            {
                verticesOfNewRidgeBoundary[verticesOfNewRidgeBoundary.Length - 1 - i] = lines[i - 1].End;
                int ID = mesh.AddVertex(verticesOfNewRidgeBoundary[verticesOfNewRidgeBoundary.Length - 1 - i]);
            }
            //New Ridges
            Edge <T>[]   newEdges;
            Edge <T>[]   newNeighborEdges;
            MeshCell <T> newCell = new MeshCell <T> {
                Node = new T()
            };

            newCell.Node.Position = cell.Node.Position;
            mesh.AddCell(newCell);
            MeshMethods.CreateBoundaryEdge(verticesOfNewRidgeBoundary, cell, newCell, out newEdges, out newNeighborEdges, boundaryCount);
            //Link Ridges to old neighbors
            MeshMethods.InsertEdgesAndVertices(newEdges, newNeighborEdges);

            //dOnE, DoNe!
            return(edge);
        }