예제 #1
0
    # 注意索引与数量之间相差1
    if not triangleList[K].edge12:
        p1 = triangleList[K].p1
        p2 = triangleList[K].p2
        if not Functions.isRepeat(p1, p2, triangleList):
            index = Functions.find_Point_index(1, PointList, triangleList[K])
            if index != -1:  #拓展
                L = L + 1
                t1.append(triangleList[K].p1)
                t2.append(triangleList[K].p2)
                t3.append(PointList[index])
                plt.plot([t1[L].x, t3[L].x], [t1[L].y, t3[L].y])
                plt.plot([t3[L].x, t2[L].x], [t3[L].y, t2[L].y])

                tri = Triangle(t1[L], t2[L], t3[L])
                tri.edge12 = True
                triangleList.append(tri)

    if not triangleList[K].edge13:
        p1 = triangleList[K].p1
        p2 = triangleList[K].p3
        if not Functions.isRepeat(p1, p2, triangleList):
            index = Functions.find_Point_index(2, PointList, triangleList[K])
            if index != -1:  # 拓展
                L = L + 1
                t1.append(triangleList[K].p1)
                t2.append(triangleList[K].p3)
                t3.append(PointList[index])
                plt.plot([t1[L].x, t3[L].x], [t1[L].y, t3[L].y])
                plt.plot([t3[L].x, t2[L].x], [t3[L].y, t2[L].y])