import numpy as np def insert_points2(start,end,amounts): """start:起始坐标,end:结束坐标,amounts:要生成的点数""" xs = np.linspace(start[0],end[0],amounts) ys = np.linspace(start[1],end[1],amounts) return list(zip(xs,ys)) def insert_points(start,end,amounts): """start:起始坐标,end:结束坐标,amounts:要生成的点数""" xy = np.linspace(start,end,amounts) return [tuple(cors) for cors in xy] start = (0,0) end = (100,100) ps = insert_points(start,end,11) print(len(ps)) print(ps)
李兴球
李兴球的博客是Python创意编程原创博客
要发表评论,您必须先登录。
发表评论