How to present OBJ file (read as a mesh file) in a contour plot?
30 ビュー (過去 30 日間)
古いコメントを表示
I have collected some scans (file format of model from the scanner: .obj, .mtl and .jpg). I am able to read the files as a 3D mesh, and am looking for ways I can create a contour plot under the mesh
回答 (2 件)
ANKUR KUMAR
2018 年 10 月 10 日
An example of creating a mesh is here,
[X,Y] = meshgrid(-5:.2:5);
R = sqrt(X.^2 + Y.^2);
Z = sin(R)./R;
mesh(X,Y,Z)
2 件のコメント
KSSV
2018 年 10 月 10 日
@ ANKUR KUMAR the user already able to plot the mesh..he wants the contour plot.
@ Colin Hollar attach one sample file...it can be done.
KSSV
2018 年 10 月 10 日
This should work out:
obj = readObj(fname) ;
p = obj.v ;
t = obj.f ;
N = 10 ;
[c,h]=tricontour(t,p(:,1),p(:,2),p(:,3),N) ;
Get the tricontour function from the file exchange: https://in.mathworks.com/matlabcentral/fileexchange/38858-contour-plot-for-scattered-data?focused=5249779&tab=function
1 件のコメント
KSSV
2018 年 10 月 10 日
I think you should draw mesh for that, try:
trisurf(t,p(:,1),p(:,2),p(:,3))
As your question was plotting contours...I gave code for contours. Also change the value of N and try. Increase the value of N.
参考
カテゴリ
Help Center および File Exchange で Contour Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!