TRANSFORMPLANE3D Transform a 3D plane with a 3D affine transform. PLANE2 = transformPlane3d(PLANE, TRANS) Example p1 = [10 20 30]; p2 = [30 40 50]; p3 = [0 -10 -20]; plane = createPlane(p1, p2, p3); rot = createRotationOx(p1, pi/6); plane2 = transformPlane3d(plane, rot); figure; hold on; axis([0 100 0 100 0 100]); view(3); drawPlane3d(plane, 'b'); drawPlane3d(plane2, 'm'); See also: lines3d, transforms3d, transformPoint3d, transformVector3d, transformLine3d
0001 function plane2 = transformPlane3d(plane, trans) 0002 %TRANSFORMPLANE3D Transform a 3D plane with a 3D affine transform. 0003 % 0004 % PLANE2 = transformPlane3d(PLANE, TRANS) 0005 % 0006 % Example 0007 % p1 = [10 20 30]; 0008 % p2 = [30 40 50]; 0009 % p3 = [0 -10 -20]; 0010 % plane = createPlane(p1, p2, p3); 0011 % rot = createRotationOx(p1, pi/6); 0012 % plane2 = transformPlane3d(plane, rot); 0013 % figure; hold on; 0014 % axis([0 100 0 100 0 100]); view(3); 0015 % drawPlane3d(plane, 'b'); 0016 % drawPlane3d(plane2, 'm'); 0017 % 0018 % See also: 0019 % lines3d, transforms3d, transformPoint3d, transformVector3d, 0020 % transformLine3d 0021 % 0022 0023 % ------ 0024 % Author: David Legland, oqilipo 0025 % e-mail: david.legland@inra.fr 0026 % Created: 2017-07-09 0027 % Copyright 2017 INRA - BIA PV Nantes - MIAJ Jouy-en-Josas. 0028 0029 plane2 = [... 0030 transformPoint3d( plane(:,1:3), trans) ... % transform origin point 0031 transformVector3d(plane(:,4:6), trans) ... % transform 1st dir. vect. 0032 transformVector3d(plane(:,7:9), trans)]; % transform 2nd dir. vect.