Monday, July 15, 2013

Transformation of points

%transformation of points
%consider the effect of multiplying an arbitrary point(1x2) with a (2x2) transformation matrix

syms x y
syms a b c d
point=[x y];%(1x2)point
T=[a b;c d];%(2x2) transformation matrix
%%
transformed_point=point*T %transformed coordinates
%result:the transformed coordinates come out to be transformed_point=[ x*a+y*c, x*b+y*d]
%%
%case 1 a=d=1, b=c=0:identity transformation
a=1;
d=1;
b=0;
c=0;
 T=[a b;c d];
transformed_point=point*T %transformed coordinates
%transformed_point =[ x, y]

%%
%case 2 d=1, b=c=0:scaling the x coordinate
syms a
d=1;
b=0;
c=0;

 T=[a b;c d];
transformed_point=point*T %transformed coordinates

%result transformed_point =[ x*a,   y]

%%
%case 3 a=1 b=c=0:scaling the y coordinate

syms d
a=1;
b=0;
c=0;
 T=[a b;c d];

transformed_point=point*T %transformed coordinates

%result transformed_point =[   x, y*d]

%%
%case 4 b=c=0:scaling both x and y coordinates

syms a d
b=0;
c=0;
 T=[a b;c d];

transformed_point=point*T %transformed coordinates

%result transformed_point =[ x*a, y*d]







(a) Scaling along X axis with a scaling factor of 2 ; original point in blue color;transformed point in red color

(b)Scaling along Y axis with a scaling factor of 2 ; original point in blue color;transformed point in red color
 (c)Scaling along X and Y axes,each with a scaling factor of 2 ; original point in blue color;transformed point in red color

No comments:

Post a Comment