Exemple #1
0
        void HandleLastCell(List <BoundaryLine> lines)
        {
            //Handle last cell
            //-----------------------------------------------------------
            switch (state.Case)
            {
            case IntersectionCase.NotIntersecting:
                lines.AddRange(firstCell.linesFirstCell);
                meshIntersecter.CloseMesh(lines, firstCell.firstCellCutRidge, boundaryLines.LineIndex());
                break;

            case IntersectionCase.EndOfLine:
            case IntersectionCase.EndOfEdgeAndLine:
                if (firstCell.CutCase != IntersectionCase.StartOfLine)
                {
                    CyclicInterval lineIndex = boundaryLines.LineIndex();
                    lineIndex.Previous();
                    meshIntersecter.CloseMesh(firstCell.firstCellCutRidge, lineIndex);
                }
                break;

            case IntersectionCase.EndOfEdge:
            case IntersectionCase.InMiddle:
            default:
                throw new Exception();
            }
        }
Exemple #2
0
        public static void CreateBoundaryEdge <T>(
            Vertex[] vertices,
            MeshCell <T> cell,
            MeshCell <T> neighborCell,
            out Edge <T>[] ridges,
            out Edge <T>[] twinEdges,
            CyclicInterval boundaryCount)
        {
            int count = vertices.Length - 1;

            ridges    = new Edge <T> [count];
            twinEdges = new Edge <T> [count];
            for (int i = 0; i < count; ++i)
            {
                Edge <T> ridge = new Edge <T>
                {
                    Start              = vertices[i],
                    End                = vertices[i + 1],
                    Cell               = cell,
                    IsBoundary         = true,
                    BoundaryEdgeNumber = boundaryCount.Current(),
                };
                Edge <T> twinRidge = new Edge <T>
                {
                    Start              = vertices[i + 1],
                    End                = vertices[i],
                    Twin               = ridge,
                    Cell               = neighborCell,
                    IsBoundary         = true,
                    BoundaryEdgeNumber = boundaryCount.Current(),
                };
                ridge.Twin = twinRidge;
                ridges[i]  = ridge;
                twinEdges[count - 1 - i] = twinRidge;
                boundaryCount.Previous();
            }
        }