Home > matGeom > geom2d > transformLine.m

transformLine

PURPOSE ^

TRANSFORMLINE Transform a line with an affine transform.

SYNOPSIS ^

function dest = transformLine(line, trans)

DESCRIPTION ^

TRANSFORMLINE Transform a line with an affine transform.

   LINE2 = transformLine(LINE1, TRANS);
   returns the line LINE1 transformed with affine transform TRANS. 
   LINE1 has the form [x0 y0 dx dy], and TRANS is a transformation
   matrix.

   Format of TRANS can be one of :
   [a b]   ,   [a b c] , or [a b c]
   [d e]       [d e f]      [d e f]
                            [0 0 1]

   LINE2 = transformLine(LINES, TRANS);
   Also work when LINES is a [N*4] array of double. In this case, LINE2
   has the same size as LINE. 

   See also:
   lines2d, transforms2d, transformPoint

   ---------
   author : David Legland
   INRA - TPV URPOI - BIA IMASTE
   created the 06/04/2004.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function dest = transformLine(line, trans)
0002 %TRANSFORMLINE Transform a line with an affine transform.
0003 %
0004 %   LINE2 = transformLine(LINE1, TRANS);
0005 %   returns the line LINE1 transformed with affine transform TRANS.
0006 %   LINE1 has the form [x0 y0 dx dy], and TRANS is a transformation
0007 %   matrix.
0008 %
0009 %   Format of TRANS can be one of :
0010 %   [a b]   ,   [a b c] , or [a b c]
0011 %   [d e]       [d e f]      [d e f]
0012 %                            [0 0 1]
0013 %
0014 %   LINE2 = transformLine(LINES, TRANS);
0015 %   Also work when LINES is a [N*4] array of double. In this case, LINE2
0016 %   has the same size as LINE.
0017 %
0018 %   See also:
0019 %   lines2d, transforms2d, transformPoint
0020 %
0021 %   ---------
0022 %   author : David Legland
0023 %   INRA - TPV URPOI - BIA IMASTE
0024 %   created the 06/04/2004.
0025 %
0026 
0027 %   HISTORY
0028 %   02/03/2007: rewrite function
0029 
0030 
0031 % isolate points
0032 points1 = line(:, 1:2);
0033 points2 = line(:, 1:2) + line(:, 3:4);
0034 
0035 % transform points
0036 points1 = transformPoint(points1, trans);
0037 points2 = transformPoint(points2, trans);
0038 
0039 dest = createLine(points1, points2);

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