Function File: nshape = transformShape (shape, T)

Applies transformation to a shape defined by piecewise smooth polynomials.

shape is a cell where each elements is a 2-by-(poly_degree+1) matrix containing a pair of polynomials.

Format of T can be one of :

 [c] , [a b] , [a b c] or [a b c]
 [f]   [d e]   [d e f]    [d e f]
                          [0 0 1]

See also: shape2polygon, plotShape.

Demonstration 1

The following code

 shape = {[-93.172   606.368  -476.054   291.429; ...
          -431.196   637.253    11.085   163.791]; ...
         [-75.3626  -253.2337   457.1678   328.5714; ...
           438.7659  -653.6278    -7.9953   380.9336]; ...
         [-89.5841   344.9716  -275.3876   457.1429; ...
          -170.3613   237.8858     1.0469   158.0765];...
         [32.900  -298.704   145.804   437.143; ...
         -243.903   369.597   -34.265   226.648]; ...
         [-99.081   409.127  -352.903   317.143; ...
           55.289  -114.223   -26.781   318.076]; ...
         [-342.231   191.266   168.108   274.286; ...
           58.870   -38.083   -89.358   232.362]};
 warning ("off", 'geom2d:cw-shape',"local");
 A = shapeArea (shape);
 T = eye(2)/sqrt(A);
 shape = transformShape (shape,T);
 T = shapeCentroid (shape)(:);
 shape = transformShape (shape,-T + [2; 0]);

 close
 plotShape (shape,'-r','linewidth',2);
 hold on
 for i = 1:9
   T = createRotation (i*pi/5)(1:2,1:2)/exp(0.3*i);
   plotShape (transformShape(shape, T), 'color',rand(1,3),'linewidth',2);
 end
 hold off
 axis image

Produces the following figure

Figure 1

Package: geometry