PyVista从点云重建平面和曲面

发布于 2022-08-19  795 次阅读


Please refresh the page if equations are not rendered correctly.
---------------------------------------------------------------

PolyData.delaunay_2d

Apply a 2D Delaunay filter along the best fitting plane.
该函数仅仅用于从点云数据生成2D平面,而非曲面

PolyData.delaunay_2d(tol=1e-05, alpha=0.0, offset=1.0, bound=False, inplace=False, edge_source=None, progress_bar=False)

delaunay_2d — PyVista 0.36.1 documentation

例:

import pyvista
# Polygon(center=(0.0, 0.0, 0.0), radius=1, normal=(0, 0, 1), n_sides=6)
points = pyvista.Polygon(n_sides=30).points
circle = pyvista.PolyData(points)
circle.plot(show_edges=True, point_size=15)
filled_circle = circle.delaunay_2d()
filled_circle.plot(show_edges=True, line_width=5)

点云数据:

平面网格:

PolyData.delaunay_3d

PolyData.delaunay_3d(alpha=0, tol=0.001, offset=2.5, progress_bar=False)

delaunay_3d — PyVista 0.36.1 documentation
该函数实际上是从面或点云数据生成四面体网格,而非三角形面网格!

import pyvista
sphere = pyvista.Sphere(theta_resolution=5, phi_resolution=5)
grid = sphere.delaunay_3d()
edges = grid.extract_all_edges()
edges.plot(line_width=5, color='k')

PolyDataFilters.reconstruct_surface

PolyDataFilters.reconstruct_surface(nbr_sz=None, sample_spacing=None, progress_bar=False)

reconstruct_surface — PyVista 0.36.1 documentation
这是真正的从点云数据生成面的函数,采用隐式面重建方法(A signed measure of the distance to the surface is computed and sampled on a regular grid. The grid can then be contoured at zero to extract the surface. )然而,真正的大量点存在时(测试案例:26000点,等10分钟未成功,MATLAB几秒钟完成),效率堪忧。

届ける言葉を今は育ててる
最后更新于 2022-08-19