Beispiel #1
0
    protected TriangleTree GetContainingTriangle(GraphNode node)
    {
        TriangleTree tri_within        = tris;
        bool         outside_triangles = true;

        while (!tri_within.IsLeaf())
        {
            foreach (TriangleTree sub_tri in tri_within.GetChildren())
            {
                if (sub_tri.IsInTriangle(node))
                {
                    tri_within        = sub_tri;
                    outside_triangles = false;
                    break;
                }
            }
            if (outside_triangles)
            {
                return(null);
            }
            outside_triangles = true;
        }

        return(tri_within);
    }
Beispiel #2
0
    protected void EnsureEdge(TriangleTree triangle, GraphNode node)
    {
        TriangleTree adjacent = GetContainingTriangle(triangle.GetAdjacentDummy(node));

        if (adjacent != null && adjacent.IsLeaf() && adjacent.IsInCircle(node))
        {
            List <TriangleTree> new_tris = FlipEdge(triangle, adjacent);

            foreach (TriangleTree new_tri in new_tris)
            {
                EnsureEdge(new_tri, node);
            }
        }
    }