在Python
Matplotlib's path.contains_points function employs a path object to represent the polygon.它檢查給定點是否位於定義路徑內。該功能通常比提供的代碼段中所示: points = np.random.rand(10000,2)
point for ray_mothod(], points]print("Ray Tracing Elapsed time: " str(time() - start_time))
Matplotlib contains_points elapsed timestart_time = time()
path = mpltPath.Path(polygon)inside2 = path.contains_points(points)
print(“ matplotlib contrains_points經過的時間:” str(time(time() - start_time))
與matplotlib的方法相比,與ray tracing相比的方法更快地執行時間。選項
免責聲明: 提供的所有資源部分來自互聯網,如果有侵犯您的版權或其他權益,請說明詳細緣由並提供版權或權益證明然後發到郵箱:[email protected] 我們會在第一時間內為您處理。
Copyright© 2022 湘ICP备2022001581号-3