Пример #1
0
    private IEnumerator FlipEdgesConnectingOldAndNewVertices()
    {
        //foreach (Edge e in newMeshUtility.edges) {
        //    e.color = Edge.defaultColor;
        //}
        foreach (Edge edge in newMeshUtility.Edges)
        {
            if (!edge.isNew)
            {
                continue;
            }

            if (edge.Triangles.Count != 2)
            {
                edge.color = Color.grey;
                Debug.Log("[FlipEdgesConnectingOldAndNewVertices] edge tris != 2: " + edge.Triangles.Count);
                Debug.Log("[FlipEdgesConnectingOldAndNewVertices] skipping edge");
                //yield return new WaitForSeconds(0.2f);
                continue;
            }
            Vertex A = edge.Vertices[0];
            Vertex B = edge.Vertices[1];

            if (A.isNew && B.isNew)
            {
                continue;
            }


            //foreach (Triangle t in edge.Triangles) {
            //    foreach (Edge e in t.Edges) {
            //        e.color = Color.magenta;
            //    }
            //}
            //edge.color = Color.white;

            //yield return new WaitForSeconds(0.1f);

            newMeshUtility.FlipEdge(edge);

            //edge.color = Color.white;

            //yield return new WaitForSeconds(0.1f);

            //foreach (Triangle t in edge.Triangles) {
            //    foreach (Edge e in t.Edges) {
            //        e.color = Edge.defaultColor;
            //    }
            //}

            yield return(null);
        }
    }