How to rotate/tilt the data of a mesh plot?
2 views (last 30 days)
Show older comments
A plot similar to "peaks" shall be tilted. I found a piece of code to rotate/tilt the image object.
but since i have to do some other mathematical operations with the tilted data, i need to tilt the data itself. Can i tilt datda or retrieve the manipulated data from the image object?
I tried this to retrieve the data from the image object, but with no success:
% tilt image
t = hgtransform;
mesh(xr, yr, zr,'Parent',t)
Mx = makehgtform('xrotate',-alphax);
My = makehgtform('xrotate',alphay);
t.Matrix = My*Mx;
%try to retrieve data from image object
h = gcf;
axes = get(h,'Children');
dataObjs = get(axes,'Children');
lineObjs = findobj(dataObjs, 'type', 'surf');
Zdata = get(lineObjs, 'ZData');
objTypes = get(dataObjs, 'Type'); %type of low-level graphics object
Thanks
0 Comments
Answers (1)
Walter Roberson
on 6 Oct 2015
The data that is stored in the mesh is the data that is passed in, not the transformed coordinates. If you want the transformed coordinates then you need to do the matrix multiplications yourself instead of relying on the graphics system. You can still use makehgtform to help you create the transformation matrix.
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!