two-dimensional geometric transformations ch5. 참조 subjects : basic transformations homogeneous...
TRANSCRIPT
Two-Dimensional Geometric Transformations ch5. 참조
Subjects :
Basic Transformations
Homogeneous Coordinates
Composite Transformations
Other Transformations
Properties of Transformation matrix
Basic Transformations : Translation (1/2)
Translation (이동 ) Definition : repositioning objects along a straight line path
from one position to another Let : original position, : new position
We need translation distance (translation vector)
for x direction
for y direction Then,
y
x=P
y
x = P
T =t
t
x
y
x' x t
y' y t
x
y
Translation (2/2)
In matrix form
Translation is rigid-body Transformation that moves objects without deformation
• every point on the object is translated by the same amount For straight line
• applying translation distance to each line end points For polygon, curves
P' P Tx
y
t
t
x
y
Basic Transformations : Rotation (1/3)
Rotation Definition : repositioning objects along a circular path in the xy plan
e
We need to specify• rotation angle
• rotation point (pivot point)
• direction (clockwise (-), counter clockwise(+))
a rotation about a rotation axis Z
Rotation (2/3)
x' rcos( ) rcos cos rsin sin
y' rsin( rcos sin rsin cos
)
r x y2 2
x rcos ,
x' xcos ysin
y' xsin ycos
y rsin
• Rotation angle : • rotation point : origin (0,0)• direction : c.c.w
Then
• where • original points are • so,
Rotation (3/3)
In matrix form
called Rotation matrix
Rotation about an arbitrary pivot position
As with translations, rotations are
rigid-body transformations
y
x
cossin
sincosPR P
-
==
x' x (x x )cos (y y )sin
y' y (x x )sin (y y )cos
r r r
r r r
Basic Transformations : scaling (1/2)
Scaling Definition : alters the size of an objects
we need scaling factors
: for x value
: for y value
In matrix form
Then
if : Uniform scaling
: differential scaling
SS 0
0 S
X
y
x x sx' y y sy'
y
x
s0
0sPS P
y
x
s s
s s
x y
x y
scaling (2/2)
if : uniform compression• move objects to the coordinate origin
if : uniform Enlargement• move objects farther from the origin
Fixed point scaling : scaling based on a fixed point• An object is scaled relative to the fixed point by scaling distance
from each vertex to fixed point
• when
0 s s 1x y
1 s sx y
( ),x yf f
x' x (x x )s x s x (1 s )
y' y (y y )s y s y (1 s )
f f x x f x
f f y y f y
(x ,y ) (0,0)f f
Homogeneous Coordinates (1/4)
Let’s consider combination of two transformation, translation after rotation
We can combine two matrices into a single matrix
by expanding the 2x2 matrix to 3x3 matrix
i.e.
21 MPMP
y
x
t
t
y
x
cossin
sincos
x y t
x y t
x
y
cos sin
sin cos
cos sin
sin cos
? ? ?
t
t
x
y
Homogeneous Coordinates (2/4)
To utilize above 3x3 matrix,• represent Cartesian coordinate point (x,y) with the Homogeneous
Coordinate (xh, yh, h)
• where
Homogeneous CoordinateHomogeneous Coordinate : (xh, yh, h) • first developed in geometry (1946)
• applied in graphics by Roberts (1965)
• usually h=1 (called weight value)
• then (2,3) = (2,3,1) = (1,1.5,0.5)
xx
h,y
y
h
h h
Homogeneous Coordinates (3/4)
• there is infinite number of equivalent representation for point (x,y)
• origin case (0,0,1)
• for (xh, yh, h), at least one of triple must be nonzero,
i.e. (0,0,0) is not allowed
• if (x,y,0) called point at infinity
For Translation, Rotation, Scaling
1
y
x
100
t10
t01
s
y
x
y
x
1
y
x
100
0cossin
0sin-cos
s
y
x
1
y
x
100
0s0
00s
s
y
x
y
xTranslation: Scaling:
Rotation:
Homogeneous Coordinates (4/4)
with the H.G.C we can perform uniform scaling with scaling factor S
• when S>1 : Uniform compression
0<S<1 : Uniform enlargement
with the H.G.C the transformation matrix be 3x3,
i.e. m, n : translation factor
s : scaling factorT
a c m
b d n
0 0 s
1
s
y
s
x
s
y
x
s00
010
001
1
y
x
Composite Transformation (1/2)
Translation If two successive translation factor (tx1, ty1) and (tx2, ty2) are
applied to a coordinate point P• then
• ex)
i.e,
Two successive Translation are additive
1 0 t
0 1 t
0 0 1
1 0 t
0 1 t
0 0 1
1 0 t t
0 1 t t
0 0 1
x2
y2
x1
y1
x1 x2
y1 y2
P' T (t ,t ) {T (t ,t ) P} {T (t ,t ) T (t ,t )} P2 X2 y2 1 x1 y1 2 X2 y2 1 x1 y1
T(t ,t ) T(t ,t ) T(t t ,t t )x2 y2 x1 y1 x1 x2 y1 y2
Composite Transformation (2/2)
Rotation
two successive rotation
two successive rotations are also additive
Scaling
successive scalings are multiplicative
P)}R(){R(P}){R()R( P 1212 )R()R()R( 2121
P' R( ) P1 2
,
100
0ss0
00ss
100
0s0
00s
100
0s0
00s
y2y1
x2x1
y1
x1
y2
x2
S(S ,S ) S(S ,S ) S(S S ,S S )X2 Y2 X1 Y1 X1 X2 Y1 Y2
General pivot-point Rotation (1/2)
Rotation about arbitrary point p (xr, yr) step1) Translate P to origin step2) Rotation about origin step3) Retranslation to position P.
General pivot-point Rotation (2/2)
Composite transformation matrix
x
y
x
y
x y
y x
r
r
r
r
r r
r r
cos sin
sin cos
cos sin ( cos ) sin
sin cos ( cos ) sin
),y,R(x),-yT(-x)R()y,T(x rrrrrr
General Fixed-Point Scaling
Scaling about arbitrary point p(xr, yr) step 1) translate p to origin
step 2) scaling about origin
step 3) Retranslate to position P
x
y
s
s
x
y
s x s
s y s
r
r
x
y
r
r
x r x
y r y
( )
( ) )ss,y,S(x),-yT(-x)sS(s)y,T(x yxffffyxff ,,
General Scaling Directions
Normal scaling performed along x and y directions To accomplish the scaling for arbitrary direction without
changing object orientation• Rotate direction by
• Perform scaling
• Rerotate by
R S S S R
s s s s
s s s s
( ) ( , ) ( )
cos sin ( )cos sin
( )cos sin sin cos
Concatenation properties.
Matrix multiplication : associative• ex) For three matrices A, B and C
• Translation or Rotation : additive property commutative
• scaling : multiplicative property commutative
However, Translation and Rotation : non commutative• order of transformation matrix multiplication is important
A B C (A B) C A (B C)
ABBA
Other Transformations : Reflection (1/4)
Reflection : produce a mirror images of an object We need axis of reflection rotating the objects 180about reflection axis Reflection about line y=0, the x axis.
• x coordinate values are unchanged
• the transformation matrix
R
1 0 0
0 1 0
0 0 1X
Reflection (2/4)
Reflection about line x=0, the y axis• y coordinate values are unchanged
Reflection about origin• both x and y values are changed
R
1 0 0
0 1 0
0 0 1y
100
010
001
R0
Reflection (3/4)
Reflection through arbitrary point P (xr, yr)• translate point p to origin : Tr
• perform reflection about origin : Ro
• retranslate to original position : Tr
Reflection through y=x line
100
y10
x01
100
010
001
100
y10
x01
r
r
r
r
0 1 0
1 0 0
0 0 1
Reflection (4/4)
Reflection through an arbitrary line y=Lx+b
Other Transformations: Shear (1/3)
Shear : distorts the shape of an object Shearing (slide over) can be done either x or y direction x direction shearing by shearing factor shx
• point is shifted by horizontally by an amount proportional to its distance from x-axis
• y values are unchanged
Shear (2/3)
• So,
• Transformed positions
y direction shearing
x-direction shearing relative to line
T
1 sh 0
0 1 0
0 0 1shx
x
x' x sh yx , y' y
T
1 0 0
sh 1 0
0 0 1shy y
y yref
1 sh sh y
0 1 0
0 0 1
x x ref
x' x sh (y y )
y' yx ref
Shear (3/3)
y-direction shearing relative to linex xref
1 0 0
sh 1 sh x
0 0 1y y ref
x' x
y' y sh (x x )y ref
Properties of Transformation matrix (1/5)
Properties of Rotation matrix case1) rotate point p p’ c.c.w direction by
• case2) rotate point p’ p c.w. direction by
• same result to rotate ( ) to c.c.w direction
• is a Inverse matrix of
• i.e,
P' P Rx
y
cos sin
sin cos(A)
det[R ] cos sin 12 2
R( )cos(- ) - sin(-
sin(- ) cos(- )
cos sin
sin cos(B)
)
R R( ) ( )
I
R( ) R( )
Properties of Transformation matrix (2/5)
Examine (A) & (B)
then Inverse matrix = Transpose matrix of R
I.e,
So, the inverse of the general rotation matrix [R]
is its transpose Def) An nxn matrix A is an orthogonal matrix if Def) Every 2x2 orthogonal matrix R with
det[R]=1 is pure rotation matrix
R RT
cos sin
sin cos
A AT
Properties of Transformation matrix (3/5)
Properties of Reflection matrix Determinant of Reflection matrix = -1 Def) Every 2x2 orthogonal matrix R with det(R) = -1
is a pure reflection matrix If two pure reflections about line passing through the origin a
re applied successively, the result is a pure rotation about the origin
• ex) reflection through x axis (RX)
and reflection through y axis (RY)
Properties of Transformation matrix (4/5)
Rigid-body Transformation concept : moves object without deformation
• i.e, perpendicular lines transformed as perpendicular lines
or unit square remains a unit square
Translation, rotation, or combination of both
Properties of Transformation matrix (5/5)
Affine Transformation Concepts :
• parallel lines transformed as parallel lines
• finite points maps to finite points
• but not length and angle
• Rot, Trans, Ref preserves angle and length
• Tra, Rot, Sca, Ref, and Shr or combination of those