フィルターのクリア

Convert x,y,z data to surface matrices(2D array)

18 ビュー (過去 30 日間)
Arash Hajisharifi
Arash Hajisharifi 2019 年 10 月 6 日
コメント済み: darova 2019 年 10 月 8 日
Hello Everyone
i have an isosurfcae , the output of isosurfcae function is:
vertices: (27812x3)
faces:(55620x3)
so x ,y and z of this isosurface are: x=vertices(:,1), x=vertices(:,2),z=vertices(:,3)
i need to convert the vertices of this isosurface to 3 array of 2D matrices, somthing like
XX(:,:) YY(:,:) ZZ(:,:)
because there is a kernel in matlab which is called surfature to calculate curvature of a surface.the input of this function is 3 arrays of 2D matrices as x,y,z.
does anyone know how to do it?
  2 件のコメント
darova
darova 2019 年 10 月 6 日
What about griddata? Can you show the surface?
Arash Hajisharifi
Arash Hajisharifi 2019 年 10 月 7 日
編集済み: Arash Hajisharifi 2019 年 10 月 8 日
consider a sphere , which i extracted the data from isosurface function.
also i have attached the output of isosurface(which is a structure) that is called results.mat

サインインしてコメントする。

採用された回答

darova
darova 2019 年 10 月 7 日
Make new mesh in spherical
V = p.vertices;
for i = 1:3
V(:,i) = V(:,i)-mean(V(:,i)); % move to origin
end
% convert to spherical coordinates
[t1,p1,r1] = cart2sph(V(:,1),V(:,2),V(:,3));
% create new mesh (2D matrices)
tt = linspace(min(t1),max(t1),100);
pp = linspace(min(p1),max(p1),100);
[P,T] = meshgrid(pp,tt);
R = griddata(p1,t1,r1,P,T);
% convert to cartesian
[X,Y,Z] = sph2cart(T,P,R);
hold on
h1 = surf(X,Y,Z);
% set(h1,'EdgeColor','none')
hold off
camlight
axis equal
Little issue
img1.png
  2 件のコメント
Arash Hajisharifi
Arash Hajisharifi 2019 年 10 月 8 日
thank you so much for your anwer, it worked,
but is there a way to convert it directly without transfering to spherical coordinating and then transfer it back again to cartesian coordinate?
darova
darova 2019 年 10 月 8 日
There are no other ways. This is the only one (and the best)

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeScalar Volume Data についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by