如何测量控制多边形与第n条细分曲线的距离?

How to measure the distance between The control Polygon and the nth subdivision curve?

我的问题是:

如何测量生成的不同点数的细分曲线与原始控制多边形之间的距离?

#========================
# Import Libraries
#========================
import numpy as np
import matplotlib.pyplot as plt
# !pip install shapely
from shapely.geometry import Point, Polygon 

#========================
# Define the Polygon
#========================
# Define Control Points
P1 = Point(0.0, 0.0)
P2 = Point(1.0, 2.0)
P3 = Point(2.0, 2.0)
P4 = Point(4.0, 4.0)
P5 = Point(5.0, 9.0)
P6 = Point(1.0, 7.0)
# control Points List
PointList = [P1, P2, P3, P4, P5, P6]
# Define a Polygon from the list of the control points
Polygn = Polygon(PointList)
#==========================================
# Uniform Spline of Degree k = 3
#==========================================
plt.figure(num='Uniform Spline of degree k =3 Subdivision Scheme')

for n in range(5):
    PointList2 = []
    for idx in range(len(PointList)):
        # Get Three of adjacent points
        P1n = PointList[idx-2]
        P2n = PointList[idx-1]
        P3n = PointList[idx]
        # Get new First Control Point
        x21n = 0.125 * (P1n.x + 6*P2n.x + P3n.x)
        y21n = 0.125 * (P1n.y + 6*P2n.y + P3n.y)
        P21n = Point(x21n, y21n)
        PointList2.append(P21n)
        # Get new Second Control Point
        x22n = 0.5 * (P2n.x+P3n.x)
        y22n = 0.5 * (P2n.y+P3n.y)
        P22n = Point(x22n, y22n)
        PointList2.append(P22n)
    # Assign the New list of points to the old one
    PointList = PointList2
    # print(len(PointList2))
    Polygn2 = Polygon(PointList2)
    
    # 
    plt.plot(*Polygn.exterior.xy, 'ro--', linewidth=1, markersize=4, label='Original')
    plt.plot(*Polygn2.exterior.xy, 'go-', linewidth=1, markersize=2, label='Subdivision ({})'.format(n+1))
    plt.legend(bbox_to_anchor=(.68, .14), loc='upper left', borderaxespad=0.)
    plt.show(block=False)
    plt.pause(1)
    plt.clf()
#=========================
# Distance Finction
#=========================
def dist(Polygn, Polygn2):
 pass
 # return max_dist

解决方案在 Shapely 库中,Hausdorff Distance 已经在那里实现:

polygon2.hausdorff_distance(polygon)