PointCloud Voxelization¶
0. Import libraries¶
import os
import topogenesis as tg
import numpy as np
import pyvista as pv
1. read point cloud from csv file¶
pc_path = os.path.relpath('../../data/rdam_cloud.csv')
pc = tg.cloud_from_csv(pc_path)
print(type(pc))
print(pc.bounds)
print(pc)
2. regularizing random points into a lattice¶
l = pc.voxelate([1, 1, 1])
print(type(l))
print(l.unit)
print(l.bounds)
3. plot the pointcloud¶
# initiating the plotter
p = pv.PlotterITK() # ITK plotter for interactivity within the python notebook (itkwidgets library is required)
# fast visualization of the point cloud
pc.fast_notebook_vis(p)
# fast visualization of the lattice
l.fast_notebook_vis(p, show_outline=True, show_centroids=True)
# Set a camera position
p.camera_position = [(0.25, 0.18, 0.5), (0, .1, 0), (0, 1, 0)]
# plotting
p.show()