Applying 3d transformation to cuboid

2 views (last 30 days)
2one
2one on 14 Jul 2017

I have the 8 vertices of a cuboid (XYZvox) with known distance in millimetres (vox to mm) between each vertex which I transform in 3d space using the following 4d transformation matrix (M). I am really struggling to work out the new voxel to millimetre conversion for the transformed vertices. How can I work this out?

XYZvox =[ 1     1     1     1   409   409   409   409
     1     1   389   389     1     1   389   389
     1   162     1   162     1   162     1   162]
M =[0.0337    0.0958   -0.9616   -2.5360
    0.3706    0.0107    0.1012 -150.2009
    0.0201   -0.3571   -0.2550 -231.0513
         0         0         0    1.0000]
for i=1:8
poi1=XYZvox(:,i);
poi2=[XYZvox(:,i)];
poi2(4,1)=1;
poi_trans=M*poi2;
poi_trans=poi_trans(1:3);
scatter3(poi1(1),poi1(2),poi1(3),'red','filled'); xlabel('x'); hold all;
scatter3(poi_trans(1),poi_trans(2),poi_trans(3),'green','filled'); xlabel('x'); ylabel('y'); zlabel('z'); 
end

Answers (0)

Community Treasure Hunt

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

Start Hunting!