在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