# Cutting 3D Point cloud and interpolate between points

I have the following data

https://www.mediafire.com/file/f8tz1zbpxvyvko7/Waltersdorf_F3.csv/file

Which is a 3D point cloud.

I can visualize it correctly, but I want to do Cuts like the ones in the red lines ( Linear cuts), at these cuts, interpolate between the values of the 3D point cloud and perform 2D plotting of that Line (Cut) and the 2D interpolated values.

Would someone suggest an approach or an algorithm ?

enter image description here

Here is what I have done so far, but You don't need to use PyPCL library for point cloud, you can work with the original data...

def main():

#process first point cloud

f3data = np.loadtxt(r'C:\ahmed\Waltersdorf_feld3_4.csv', delimiter=',', dtype=[('sp', np.str_, 20), ('x1', np.float32), ('x2', np.float32), ('x3', np.float32)])

ptcloud_1 = np.vstack((f3data['x1'], f3data['x2'], f3data['x3'])).transpose()
pc_1 = pcl.PointCloud.PointXYZ(ptcloud_1)

#plotScatterRot3(f3rot)
pc_type = utils.get_point_cloud_type(pc_1)
seg = getattr(pcl.segmentation.SACSegmentation, pc_type)()
seg.setOptimizeCoefficients(True)
model = getattr(pcl.sample_consensus, "SACMODEL_" + 'PLANE'.upper())
seg.setModelType(model)

seg.setMethodType(pcl.sample_consensus.SAC_RANSAC)
seg.setDistanceThreshold(1)
seg.setInputCloud(pc_1)
coefficients = pcl.ModelCoefficients()
inliers = pcl.PointIndices()
seg.segment(inliers, coefficients)
inla = pc_1.xyz[inliers.indices]

cloud_filtered = pcl.PointCloud.PointXYZ(inla)
pcl.io.savePCDFile("original_first.txt", cloud_filtered)

X = np.vstack((cloud_filtered.x, cloud_filtered.y, cloud_filtered.z)).transpose()
pca = decomposition.PCA(n_components=3)
pca.fit(X)
X = pca.transform(X)

# Verify that everything looks right.

import matplotlib.pyplot as plt
import mpl_toolkits.mplot3d as m3d

ax = m3d.Axes3D(plt.figure())

ax.scatter3D(*X.T)
plt.show()