MATLAB Answers


How to present OBJ file (read as a mesh file) in a contour plot?

Asked by Colin Hollar on 10 Oct 2018
Latest activity Edited by Colin Hollar on 10 Oct 2018
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

  1 Comment

As you have data in hand...can't you use contour ?

Sign in to comment.

2 Answers

Answer by ANKUR KUMAR on 10 Oct 2018

An example of creating a mesh is here,
[X,Y] = meshgrid(-5:.2:5);
R = sqrt(X.^2 + Y.^2);
Z = sin(R)./R;


@ ANKUR KUMAR the user already able to plot the mesh..he wants the contour plot.
@ Colin Hollar attach one sample can be done.
Ops. I misread the question.

Sign in to comment.

Answer by KSSV
on 10 Oct 2018

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) ;

  1 Comment

I think you should draw mesh for that, try:
As your question was plotting contours...I gave code for contours. Also change the value of N and try. Increase the value of N.

Sign in to comment.