For me the fastest way would be using numpy where you have to send a numpy array of (x,y) cordinates as an argument in shoelace method:import numpy as npdef shoelace(x_y): x_y = np.array(x_y) x_y = x_y.reshape(-1,2) x = x_y[:,0] y = x_y[:,1] S1 = np.sum(x*np.roll(y,-1)) S2 = np.sum(y*np.roll(x,-1)) area = .5*np.absolute(S1 - S2) return area 这篇关于鞋带配方的最快方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 08-16 07:14