3D to 2D projection

23 views (last 30 days)
Javad Hashemi
Javad Hashemi on 5 Dec 2013
Hi fellow Matlabers,
I have xyz coordinate of vertices of a 3D object. I am attaching a plot of the object which I created using the following code:
patch(P1X,P1Y,P1Z,'c','FaceAlpha',0.75);
My objective is to have this shell opened (flattened or projected) on a plane. Similar to what is done with earth map (Map projection in Matlab Mapping toolbox here). However, I think their algorithms are based on the assumption that earth is a homogeneous perfect sphere or ellipsoid which is not my case. Additionally, they used specific geodata formats.
I have tried using viewmtx command but it only gives a 2D projection from camera viewing angle. This does not do the job:
A = viewmtx(-37.5,30);
[m,n] = size(x);
x4d = [x(:),y(:),z(:),ones(m*n,1)]';
x2d = A*x4d;
x2 = zeros(m,n); y2 = zeros(m,n);
x2(:) = x2d(1,:);
y2(:) = x2d(2,:);
figure
scatter(x2,y2)
Any help and suggestion would be highly appreciated.
Cheers, Javad
  1 Comment
Arunkumar Rathinam
Arunkumar Rathinam on 10 Aug 2019
any updates on this.... on how you solved the problem ??.. any code or link would be really helpful.

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!