コード例 #1
0
        /// <summary>
        /// After a flip we have two triangles and know that only one will still be
        /// intersecting the edge. So decide which to contiune with and legalize the
        /// other
        /// </summary>
        ///
        /// <param name="tcx"></param>
        /// <param name="o">should be the result of an orient2d( eq, op, ep )</param>
        /// <param name="t">triangle 1</param>
        /// <param name="ot">triangle 2</param>
        /// <param name="p">a point shared by both triangles</param>
        /// <param name="op">another point shared by both triangles</param>
        /// <returns>the triangle still intersecting the edge</returns>
        private static DelaunayTriangle nextFlipTriangle(DTSweepContext tcx,
                                                         Orientation o,
                                                         DelaunayTriangle t,
                                                         DelaunayTriangle ot,
                                                         TriangulationPoint p,
                                                         TriangulationPoint op)
        {
            int edgeIndex;

            if (o == Orientation.CCW)
            {
                // ot is not crossing edge after flip
                edgeIndex           = ot.edgeIndex(p, op);
                ot.dEdge[edgeIndex] = true;
                legalize(tcx, ot);
                ot.clearDelunayEdges();
                return(t);
            }
            // t is not crossing edge after flip
            edgeIndex          = t.edgeIndex(p, op);
            t.dEdge[edgeIndex] = true;
            legalize(tcx, t);
            t.clearDelunayEdges();
            return(ot);
        }