示例#1
0
    public void CheckEdge(WingedEdge w)
    {
        bool aux = false;

        foreach (EdgeWE e in w.Edges)
        {
            if (e.LeftFace != null && e.RightFace != null)
            {
                List <VertexWE> v1 = w.GetFaceVertices(e.RightFace);
                List <VertexWE> v2 = w.GetFaceVertices(e.LeftFace);

                VertexWE RightOppositeVertex = null;
                VertexWE LeftOppositeVertex  = null;


                for (int i = 0; i < v1.Count; i++)
                {
                    if (!Equals(v1[i], e.Vertex1) && !Equals(v1[i], e.Vertex2))
                    {
                        RightOppositeVertex = v1[i];
                    }
                    if (!Equals(v2[i], e.Vertex1) && !Equals(v2[i], e.Vertex2))
                    {
                        LeftOppositeVertex = v2[i];
                    }
                }
                Vector3 Rightcc       = CalculateCircumscribedCircumference(v1[0], v1[1], v1[2]);
                Vector3 Leftcc        = CalculateCircumscribedCircumference(v2[0], v2[1], v2[2]);
                double  RightccRadius = CalculateRadius(Rightcc, v1[0], v1[1], v1[2]);
                double  LeftccRadius  = CalculateRadius(Leftcc, v2[0], v2[1], v2[2]);
                if (InsideCC(Rightcc, RightccRadius, LeftOppositeVertex) || InsideCC(Leftcc, LeftccRadius, RightOppositeVertex))
                {
                    List <FaceWE> newfaces = w.FlipEdge(e);
                    aux = true;
                    break;
                }
            }
        }
        if (aux)
        {
            CheckEdge(w);
        }
    }