I am having some trouble creating sensical shapes when rotating kArray 2D elements in a 3D simulation. For example, the addRectElement makes a flat rectangle structure when the angle of rotation is [0,0,0], but with any other angle of rotation, it forms a 3D rectangular prism with + shaped structures on the end when the binary mask is visualized in volumeViewer or similar. I have found this to be the case with other element shapes as well when rotated. Is there a fix for this to obtain the expected rotated structures?
Sample code:
% =========================================================================
% DEFINE THE K-WAVE GRID
% =========================================================================
% set the size of the perfectly matched layer (PML)
PML_X_SIZE = 10; % [grid points]
PML_Y_SIZE = 10; % [grid points]
PML_Z_SIZE = 10; % [grid points]
PML_size = [PML_X_SIZE, PML_Y_SIZE, PML_Z_SIZE];
% set total number of grid points not including the PML
Nx = 256 - 2*PML_X_SIZE; % [grid points]
Ny = 256 - 2*PML_Y_SIZE; % [grid points]
Nz = 256 - 2*PML_Z_SIZE; % [grid points]
grid_size = [Nx, Ny, Nz];
% calculate the spacing between the grid points
dx = 2e-4; % [m]
dy = dx; % [m]
dz = dx; % [m]
% create the k-space grid
kgrid = kWaveGrid(Nx, dx, Ny, dy, Nz, dz);
%% =========================================================================
% DEFINE KARRAY
% =========================================================================
karray = kWaveArray;
karray.addRectElement([-6e-3,1.5e-3,0],5e-3, 2e-4, [90, 0, 0]);
source_mask = karray.getArrayBinaryMask(kgrid);
slice(single(source_mask), 127,88,118);
% =========================================================================
Edit: My apologies, it seems I have submitted this under the wrong forum subject but there is no way to delete.