Orthogonal projection of solid

10 vues (au cours des 30 derniers jours)
Giovanni
Giovanni le 22 Juil 2011
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.

Réponse acceptée

Giovanni
Giovanni le 25 Juil 2011
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 commentaires
Walter Roberson
Walter Roberson le 25 Juil 2011
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 le 25 Juil 2011
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!

Connectez-vous pour commenter.

Plus de réponses (1)

Doug Hull
Doug Hull le 22 Juil 2011
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.

Catégories

En savoir plus sur Lighting, Transparency, and Shading dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by