Volume Slicing Dilemma: how can I cut a non orthogonal slice?

6 views (last 30 days)
Kind all,
I am trying to cut a non orthogonal slice of a volume (size 200*200*100) using MATLAB 2013B.
I've read multiple times all the Mathworks pages about slicing volumes with planes and also tested various File Exchange functions, but I am truly unable to get out of this problem.
So far I understood that for MATLAB to slice a volume, one must create a surface which acts as a "knife" and then use the XData, YData and ZData of that surface to cut the volume of interest. To obtain a non-orthogonal slice, is sufficient to apply multiple rotate commands to a orthogonal surface.
So here's what I did:
  • Set the "stage": my volume (called v_i) is composed of wind speed data, plaid on a regular grid. I created my three axis meshgrids (UTM Longitude, UTM Latitude and Altitude, which I called Xgrid, Ygrid and Zgrid) that define my volume
  • Created the "knife": I've created an horizontal surface and tried both with slice and surf, nothing changes, the only true difference is that slice is applied to the volume of interest and therefore the CData will depend on the data of the volume at the slicing point, but it does not change the procedure since both slice and surfaces are essentialy the same thing. Anyway, here's the command planarslice = slice(Xgrid,Ygrid,Zgrid,v_i,[],[],50), which cuts a slice on the z axis exactly in the middle of the dataset. Looks like it's working:
What I notice is that, while the x and y axes are represented correctly, the z one is arbitrary (that's how a surface is handled for what I can see).
  • Applied two sets of rotation, one of 90° around the x axis (i.e.: rotate(planarslice,[1 0 0],90)) and one of about 34.51° around the z axis (i.e.: right after the first rotate command, on the same handle, I ran rotate(planarslice,[0 0 1],34.51). And the rotation worked as intended:
  • I then get my slice data by using get on the XData,|YData| and ZData parameters (I've stored them in variables called xs, ys and zs)
  • Now I applied those information to my original volume via the slice command wind_slice=(Xgrid,Ygrid,v_i,xs,ys,zs). And here's where everything crashes down. The output of that command is the following plot:
That is the slice I get. I think that the NaN outputs derive from the fact that I rotated a 200*200 surface on a 200*100 plane. That's fine, and, in fact, my wind data are the colored part of the plot. The point is that, being my volume v_i filled with data (no NaNs in there), and that the slice should span an entire "transect" of my volume, I should get out at least 200*100=20 000 points out of my slice. Instead the number of non-NaNs value within my slice's CData is 3800, way below what I've expected.
What did I do wrong? How could I extract a non-orthogonal slice of my volume if not like this?
Thanks for your precious help!

Answers (0)

Products

Community Treasure Hunt

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

Start Hunting!