3D modelling from 2D plot

2 views (last 30 days)
Paul Hill
Paul Hill on 4 May 2015
Edited: Jan on 4 May 2015
I have a colleagues code that takes a 2D plot and makes a 3D profile by rotating round the centre axis I believe using this code;
% Interpolation of the shape of the 2D grid
z_f = zeros(4096,4096);
r_f = nm_per_px.*sqrt((Gx(Grid == 1)).^2+(Gy(Grid == 1)).^2);
z_f(Grid == 1) = interp1(r_for_smooth,z_for_smooth,r_f);
I had input to this code two straight lines that form a point (shown below)and will thus end up a 3D cone. What I wish to do is change his code so that it makes a pyramid instead. Any help is appreciated.
My point code;
FoV = 7000
N = 100000;
r = [-FoV/2:FoV/N:FoV/2];
z(r<0) = (-(1/7)*r(r<0));
z(r>0) = ((1/7)*r(r>0));
  2 Comments
Jan
Jan on 4 May 2015
Edited: Jan on 4 May 2015
Please format the code to make it readable. Use the "{} Code" button.
A question: Did you see that your code is not readable? So many users do not care about this obvious fact and I cannot understand, why it is not important for them to make it is easy as possible for the readers. Only a tiny part of the users add a notice, that they recognize the messy appearance.

Sign in to comment.

Answers (0)

Categories

Find more on 3-D Scene Control in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!