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

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 % E-mail: david.legland@inrae.fr
0024 % Created: 2004-04-06
0025 % Copyright 2004-2024 INRA - TPV URPOI - BIA IMASTE
0026 
0027 % isolate points
0028 points1 = line(:, 1:2);
0029 points2 = line(:, 1:2) + line(:, 3:4);
0030 
0031 % transform points
0032 points1 = transformPoint(points1, trans);
0033 points2 = transformPoint(points2, trans);
0034 
0035 dest = createLine(points1, points2);

Generated on Thu 21-Nov-2024 11:30:22 by m2html © 2003-2022