TRANSFORMS2D Description of functions operating on transforms. By 'transform' we mean an affine transform. A planar affine transform can be represented by a 3x3 matrix. Example % create a translation by the vector [10 20]: T = createTranslation([10 20]) T = 1 0 10 0 1 20 0 0 1 % apply a rotation on a polygon poly = [0 0; 30 0;30 10;10 10;10 20;0 20]; trans = createRotation([10 20], pi/6); polyT = transformPoint(poly, trans); % display the original and the rotated polygons figure; hold on; axis equal; axis([-10 40 -10 40]); drawPolygon(poly, 'k'); drawPolygon(polyT, 'b'); See also: createTranslation, createRotation, createRotation90, createScaling createHomothecy, createLineReflection, createBasisTransform transformPoint, transformVector, transformLine, transformEdge rotateVector, principalAxesTransform, fitAffineTransform2d polynomialTransform2d, fitPolynomialTransform2d
0001 function transforms2d(varargin) 0002 %TRANSFORMS2D Description of functions operating on transforms. 0003 % 0004 % By 'transform' we mean an affine transform. A planar affine transform 0005 % can be represented by a 3x3 matrix. 0006 % 0007 % Example 0008 % % create a translation by the vector [10 20]: 0009 % T = createTranslation([10 20]) 0010 % T = 0011 % 1 0 10 0012 % 0 1 20 0013 % 0 0 1 0014 % 0015 % % apply a rotation on a polygon 0016 % poly = [0 0; 30 0;30 10;10 10;10 20;0 20]; 0017 % trans = createRotation([10 20], pi/6); 0018 % polyT = transformPoint(poly, trans); 0019 % % display the original and the rotated polygons 0020 % figure; hold on; axis equal; axis([-10 40 -10 40]); 0021 % drawPolygon(poly, 'k'); 0022 % drawPolygon(polyT, 'b'); 0023 % 0024 % 0025 % See also: 0026 % createTranslation, createRotation, createRotation90, createScaling 0027 % createHomothecy, createLineReflection, createBasisTransform 0028 % transformPoint, transformVector, transformLine, transformEdge 0029 % rotateVector, principalAxesTransform, fitAffineTransform2d 0030 % polynomialTransform2d, fitPolynomialTransform2d 0031 0032 0033 % ------ 0034 % Author: David Legland 0035 % e-mail: david.legland@inra.fr 0036 % Created: 2008-10-13, using Matlab 7.4.0.287 (R2007a) 0037 % Copyright 2008 INRA - BIA PV Nantes - MIAJ Jouy-en-Josas. 0038 0039 help('transforms2d');