필터 지우기
필터 지우기

Orthogonal projection of solid

조회 수: 9 (최근 30일)
Giovanni
Giovanni 2011년 7월 22일
I'm trying to obtain an orthogonal projection of a solid. I can easily plot my solid using surf and what I need is basically what I see on my figure but in the form of a matrix. Also, I only need the shadow of my projection.
Is there an easy way to do this through MATLAB code? I have been looking all morning and couldn't find anything yet.

채택된 답변

Giovanni
Giovanni 2011년 7월 25일
I think I found a good solution. After I generate a solid with coordinates X, Y, Z, I can plot it using surf:
h = surf(X,Y,Z);
and then I can use that handle to rotate it at my will:
rotate(h,rot_axis,beta,rot_axis);
At this point I need to get my data as if it was an orthogonal projection. To do this, I first set the view to be orthogonal to the xz-plane:
view([0 0])
and then I retrieve the rotated data:
XX = get(h,'xdata');
YY = get(h,'ydata');
ZZ = get(h,'zdata');
As Doug Hull suggested, I can use this data to retrieve the solid projection by taking the min-max for each row (or column). I haven't implemented this part yet but I think it's easy. Thanks!
  댓글 수: 6
Walter Roberson
Walter Roberson 2011년 7월 25일
Ah, rotate() does modify the object data; rotate3d() and view() and hgtransforms do not modify the object data.
As view() does not modify the object data, you could skip the view() step if you are just interested in extracting the information.
If you _are_ just interested in extracting the information, it would probably be more efficient to multiply your data by the rotation matrix without going to graphics at all.
Giovanni
Giovanni 2011년 7월 25일
You're right. It takes a very long time to go through the whole process. I'm going to directly implement the rotation instead.
Thanks!

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Doug Hull
Doug Hull 2011년 7월 22일
It sounds like you want the 'shadow' as if there was a light at -inf in the X and see what gets cast on a wall on inf side of your surface.
Could you take the min and max of the surface for each Y in your surface? I think I have seen that done, and it ends up giving you a patch.

카테고리

Help CenterFile Exchange에서 Lighting, Transparency, and Shading에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by