0

I have a point cloud written in the form of (x y z) in a text file. I want to find a specific no. of points (ex.10 points) in 3d that lie at equal distances between 2 given points and that is to fill the missing points in the original point cloud as in the attached photoenter image description here

All I need is a function in python that interpolates and gets the points between each two successive points to densify the point cloud and fill the gaps. I know how to iterate between two successive points but I miss the part of interpolation!

I found a trial that didn't work with me:

# Pseudocode:
for (x from p1.x to p2.x)
    for (y from p1.y to p2.y)
        for (z from p1.z to p2.z)
            new_point = (x, y, z) 
youssef
  • 103
  • 1
  • 8
  • Try this: [Is there a multi-dimensional version of arange/linspace in numpy?](https://stackoverflow.com/a/32208788/3080723) – Stef May 24 '22 at 14:21
  • 1
    Or perhaps simpler: `new_points = list(zip(np.linspace(p1.x, p2.x, 11), np.linspace(p1.y, p2.y, 11), np.linspace(p1.z, p2.z, 11)))[1:-1]` – Stef May 24 '22 at 14:24
  • The 2nd one got what I need ! Thanks a lot @Stef – youssef May 24 '22 at 15:19

0 Answers0