M
is an affine transformation matrix that can transform coordinates from one coordinate system to another as follows:
v_old = [ x_old y_old z_old 1];
v_new = M * v_old;
% v_new contains [ x_new y_new z_new 1 ]
Now, I've got coordinates on the form of ndgrid/meshgrid:
[ X_old Y_old Z_old ] = ndgrid( 0:15 ); % for instance
How can I convert these to X_new
etc?
I could do it with three for-loops loop (X_old(i,j,k)
corresponds to x_old
above) but there must be a better solution.