Interpolate Points of a 3D Point Cloud?

조회 수: 86 (최근 30일)
newbie
newbie 2020년 2월 21일
댓글: Diego Hens 2020년 8월 25일
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?
  댓글 수: 2
darova
darova 2020년 2월 21일
Please attach your data as file. It's annoying
newbie
newbie 2020년 2월 21일
I´m sorry, attached as file.

댓글을 달려면 로그인하십시오.

채택된 답변

darova
darova 2020년 2월 21일
  • Use griddata to create surface
  • Use contour3 to create crossection
clc,clear
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
plot3(x,y,z,'.b')
hold on
surf(X,Y,Z,'faceColor','none','edgecolor',[1 1 1]*0.8)
contour3(X,Y,Z,[34 38])
hold off
axis equal
Result
  댓글 수: 2
newbie
newbie 2020년 2월 21일
편집: newbie 2020년 2월 21일
Thank you! That helps me a lot!
My example with the cone was pretty simple, as it has a circular crosssection. Later on, the objects will be various forms of a polygon. I´ll try to adapt your approach ...
Diego Hens
Diego Hens 2020년 8월 25일
Thanks, this is going to be useful. I don't know how exactly, but it will :D

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Daniel Vieira
Daniel Vieira 2020년 2월 21일
try the scatteredInterpolant, should work fine with these points (not so much if you had a closed surface)
  댓글 수: 2
newbie
newbie 2020년 2월 21일
I`ve read about scatteredInterpolant, but it doesn´t really makes sense to me, as it needs a function v (but I only have the given data points that I added to my question).
Daniel Vieira
Daniel Vieira 2020년 2월 26일
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.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Point Cloud Processing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by