MATLAB Answers

kai
0

slicing a volume in desired direction

Asked by kai
on 10 Jun 2019
Latest activity Commented on by kai
on 10 Jun 2019
ver- 2018a
I have two matrices one with vertices (560 × 3) and faces (1112×3)
After using patch command i get cylinder figure (see atached image).
Since i dont have an equation for volume as shown in matlab document, inorder to use the vertices matrix with slice command i tried to reshape it to B= (56×3×10) .
>>[X,Y,Z] = meshgrid(-2 : 0.2 : 2);
>> slice(X, Y, Z, B, 0, [], [])
I get the following error .
Error using griddedInterpolant
The grid vectors do not define a grid of points that match the given values.
Error in interp3 (line 146)
F = griddedInterpolant(X, Y, Z, V, method,extrap);
Error in slice (line 103)
vi = interp3(x,y,z,v,xi,yi,zi,method);
Is there any alternative to this slice command ,any suggestion is helpful .
Thank you.

  0 Comments

Sign in to comment.

1 Answer

Answer by LO
on 10 Jun 2019

I am not sure what you want to achieve
perhaps you could use the find function to determine vertices ranges, select them, and use them to render another cylinder (slicing the first one). Would this make sense ?

  1 Comment

kai
on 10 Jun 2019
Thank you for commenting on the question.
since from matlab document when you want to use the slice command you need to have a equation for V in terms of x,y,z and also mesh grid must be defined.
But i dont have an equation for 'V' ,instead i tried to reshape the vertex matrix because when i try to use the matrix 'V' as is in teh slice command i got an error saying that the term 'V' while using the slice command must be 3D array.
I just want to slice the given cylinder into series of 2D images so that i can binarize them after -wards and use it in 3d printing.
But i am not able to understand ,how to proceed using slice command without an equation for 'V' .
Is there an alternative for the given problem.
Thank you.

Sign in to comment.