Interpolate Points of a 3D Point Cloud?

117 views (last 30 days)
I am trying to interpolate data points (x, y, z) to get a point cloud with higher density.
I have triangulation points (x-y-z coordinates) and faces from a .stl-file (imported with stlread()) that I can work with. (DATA is attached).
In the attached image you can see the given data points (BLUE) and indicated the points I want to create (RED) - but for the whole geometry and in larger numbers.
Any ideas?
newbie on 21 Feb 2020
I´m sorry, attached as file.

Sign in to comment.

Accepted Answer

darova on 21 Feb 2020
  • Use griddata to create surface
  • Use contour3 to create crossection
load data.txt
x = data(:,1);
y = data(:,2);
z = data(:,3);
[t,r] = cart2pol(x,y);
rr = linspace(min(r),max(r),20);
tt = linspace(0,2*pi,20);
[T,R] = meshgrid(tt,rr); % new mesh
[X,Y] = pol2cart(T,R); % convert new mesh to cartesian
Z = griddata(x,y,z,X,Y); % according Z coordinates
hold on
surf(X,Y,Z,'faceColor','none','edgecolor',[1 1 1]*0.8)
contour3(X,Y,Z,[34 38])
hold off
axis equal
Diego Hens
Diego Hens on 25 Aug 2020
Thanks, this is going to be useful. I don't know how exactly, but it will :D

Sign in to comment.

More Answers (1)

Daniel Vieira
Daniel Vieira on 21 Feb 2020
try the scatteredInterpolant, should work fine with these points (not so much if you had a closed surface)
Daniel Vieira
Daniel Vieira on 26 Feb 2020
Actually it doesn't need any function, it does exactly the same thing as griddata (others posted solutions above using it). The difference is griddata creates the interpolation over the given points and that's it, while scatteredInterpolant creates a reusable interpolator for you to use in any points you want how many times you need.

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by