Home > matGeom > geom3d > transformLine3d.m

transformLine3d

PURPOSE ^

TRANSFORMLINE3D Transform a 3D line with a 3D affine transform.

SYNOPSIS ^

function res = transformLine3d(line, trans)

DESCRIPTION ^

TRANSFORMLINE3D Transform a 3D line with a 3D affine transform.

   LINE2 = transformLine3d(LINE1, TRANS)

   Example
   P1 = [10 20 30];
   P2 = [30 40 50];
   L = createLine3d(P1, P2);
   T = createRotationOx(P1, pi/6);
   L2 = transformLine3d(L, T);
   figure; hold on;
   axis([0 100 0 100 0 100]); view(3);
   drawPoint3d([P1;P2]);
   drawLine3d(L, 'b');
   drawLine3d(L2, 'm');

   See also:
   lines3d, transforms3d, transformPoint3d, transformVector3d

 ------
 Author: David Legland
 e-mail: david.legland@grignon.inra.fr
 Created: 2008-11-25,    using Matlab 7.7.0.471 (R2008b)
 Copyright 2008 INRA - BIA PV Nantes - MIAJ Jouy-en-Josas.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function res = transformLine3d(line, trans)
0002 %TRANSFORMLINE3D Transform a 3D line with a 3D affine transform.
0003 %
0004 %   LINE2 = transformLine3d(LINE1, TRANS)
0005 %
0006 %   Example
0007 %   P1 = [10 20 30];
0008 %   P2 = [30 40 50];
0009 %   L = createLine3d(P1, P2);
0010 %   T = createRotationOx(P1, pi/6);
0011 %   L2 = transformLine3d(L, T);
0012 %   figure; hold on;
0013 %   axis([0 100 0 100 0 100]); view(3);
0014 %   drawPoint3d([P1;P2]);
0015 %   drawLine3d(L, 'b');
0016 %   drawLine3d(L2, 'm');
0017 %
0018 %   See also:
0019 %   lines3d, transforms3d, transformPoint3d, transformVector3d
0020 %
0021 % ------
0022 % Author: David Legland
0023 % e-mail: david.legland@grignon.inra.fr
0024 % Created: 2008-11-25,    using Matlab 7.7.0.471 (R2008b)
0025 % Copyright 2008 INRA - BIA PV Nantes - MIAJ Jouy-en-Josas.
0026 
0027 res = [...
0028     transformPoint3d(line(:, 1:3), trans) ...   % transform origin point
0029     transformVector3d(line(:,4:6), trans)];     % transform direction vect.

Generated on Wed 16-Feb-2022 15:10:47 by m2html © 2003-2019