Rotate 3D Submatrix Matlab

87 Views Asked by At

I would like to rotate a cube that is a submatrix, so i only want to rotate this submatrix. How i can do this? This is the code:

clear all
close all 
Dimension = 256;
background = zeros(Dimension,Dimension,Dimension);
cubo1 = zeros(Dimension,Dimension,Dimension);
cubo2 = zeros(Dimension,Dimension,Dimension);
tam1 = 20;
cubo1(50:50+tam1,50:50+tam1,50:50+tam1) = 0.60;
tam2 = 20;
cubo2(60:60+tam2,60:60+tam2,60:60+tam2) = 0.60;
[x,y,z] = ind2sub(size(cubo1), find(cubo1));
plot3(x,y,z,'color','g','marker','.')
hold on;
[x,y,z] = ind2sub(size(cubo2), find(cubo2));
plot3(x,y,z,'color','b','marker','.')
axis([0 Dimension 0 Dimension 0 Dimension]);

i have used imrotate but rotate entire 3d matrix and i dont want that. Once rotation is done i want the new matrix 256x256x256 with the rotated submatrix (cube).

Thanks!

0

There are 0 best solutions below