0% found this document useful (0 votes)
18 views19 pages

Lecture6 CG 04 2D Transformations 2021#1 Updated

The document discusses 2D transformations in computer graphics, including translation and rotation. Translation moves objects by adding a displacement vector to the coordinates of every point. Rotation rotates objects around a pivot point by applying trigonometric functions to the point coordinates. Both operations can be represented using transformation matrices.

Uploaded by

sanegool55
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views19 pages

Lecture6 CG 04 2D Transformations 2021#1 Updated

The document discusses 2D transformations in computer graphics, including translation and rotation. Translation moves objects by adding a displacement vector to the coordinates of every point. Rotation rotates objects around a pivot point by applying trigonometric functions to the point coordinates. Both operations can be represented using transformation matrices.

Uploaded by

sanegool55
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 19

Computer Graphics

Chapter_4

2D Transformations
Lecture #1

1
Translation

2
 Translation is an operation that displaces points by a
fixed distance in a given direction.

• To specify a translation, we need only to specify a


displacement vector d, because the transformed points
are given by:
𝑃´ = 𝑃 + 𝑑
 P refer to all points on the object in its old position.

 𝑃´ refer to all points on the object in its new position.


3
(a)Object in its original position.
(b) Translated Object.
4
 We translate a two-dimensional point by adding
translation distances , 𝒕𝒙 and 𝒕𝒚 , to the original
coordinate position 𝒙, 𝒚 to move the point to a
new position 𝒙′ , 𝑦 ′ .

𝑥 ′ = 𝒙 + 𝒕𝒙

𝑦 ′ = 𝒚 + 𝒕𝒚

 The translation distance pair 𝒕𝒙 , 𝒕𝒚 is called a


translation vector or shift vector.
5
 We can express the translation equations as a
single matrix equation by using column vectors
to represent coordinate positions and the
translation vector.

 Translation is a rigid-body transformation that


moves objects without deformation.

 That is, every point on the object is translated by


the same amount.

6
 A straight Line segment is translated by applying
the transformation equation to each of the line
endpoints and redrawing the line between the
new endpoint positions.

 Polygons are translated by adding the translation


vector to the coordinate position of each vertex
and regenerating the polygon using the new set
of vertex coordinates and the current attribute
settings.
7
 Similar methods are used to translate curved
objects.

 To change the position of a circle or ellipse, we


translate the center coordinates and redraw the
figure in the new location.

 We translate other curves (for example, splines) by


displacing the coordinate positions defining the
objects, then we reconstruct the curve paths using
the translated coordinate points.
8
 Expressing positions in homogeneous coordinates
allows us to represent all geometric transformation
equations as matrix multiplications.

 Coordinates are represented with three-element


column vectors, and transformation operations are
written as 3 × 3 matrices.

𝑥′ 1 0 𝒕𝒙 𝑥
 For Translation. we have: 𝑦 ′ = 0 1 𝒕𝒚 𝑦
1 0 0 1 1 9
 The translation matrix can be written in the
abbreviated form:

𝑷′ = 𝑻 𝒕𝒙 , 𝒕𝒚 . 𝑷

with 𝑻 𝒕𝒙 , 𝒕𝒚 as the 3 by 3 translation matrix.

 The inverse of the translation matrix is obtained


by replacing the translation parameters 𝒕𝒙 and 𝒕𝒚
with their negatives: − 𝒕𝒙 and − 𝒕𝒚 .
10
Rotation

11
 A two-dimensional rotation is applied to an
object by repositioning it along a circular path in
the xy plane.

 To generate a rotation, we specify a rotation


angle 𝜃 and the position (𝒙𝒓 , 𝒚𝒓 ) of the rotation
point (or pivot point) about which the object is to
be rotated.

 Positive values for the rotation angle define


counterclockwise rotations about the pivot point.
12
 Negative values rotate objects in the clockwise
direction.

 This transformation can also be described as a


rotation about a rotation axis that is
perpendicular to the xy plane and passes
through the pivot point.

13
Two-dimensional rotation.

14
 Having specified a particular point—the origin—we
are in a particular frame.

 A two-dimensional point at (x, y) in this frame is


rotated about the origin by an angle θ to the
position (x´, y´). We can obtain the standard
equations describing this rotation by representing
(x, y) and (x´, y´) in polar form:
𝑥 = 𝜌 cos 𝜑,
𝑦 = 𝜌 sin 𝜑,
15
𝑥´ = 𝜌 cos 𝜃 + 𝜑 ,
𝑦´ = 𝜌 sin 𝜃 + 𝜑 ,

• Expanding these terms using the trigonometric


identities for the sine and cosine of the sum of two
angles, we find:
𝑥´ = 𝜌 cos 𝜃 cos 𝜑 − sin 𝜃 sin 𝜑 ,
𝑦´ = 𝜌 cos 𝜃 sin 𝜑 + sin 𝜃 cos 𝜑 ,
𝑥´ = 𝑥 cos 𝜃 − 𝑦 sin 𝜃
𝑦´ = 𝑥 sin 𝜃 + 𝑦 cos 𝜃
16
 These equations can be written in matrix form
as:
𝑥´ cos 𝜃 − sin 𝜃 𝑥
 = 𝑦
𝑦´ sin 𝜃 cos 𝜃

 Expressing positions in homogeneous


coordinates allows us to represent all geometric
transformation equations as matrix
multiplications.
17
 Coordinates are represented with three-element
column vectors, and transformation operations
are written as 3 × 3 matrices.

 For Rotation:

𝑥′ cos 𝜃 − sin 𝜃 𝟎 𝑥
we have: 𝑦 ′ = sin 𝜃 cos 𝜃 𝟎 𝑦
1 0 0 1 1

18
 The rotation matrix can be written in the
abbreviated form:

𝑷′ = 𝑹 𝜽 . 𝑷

with𝑹 𝜽 as the 3 by 3 Rotation matrix.

 The inverse of the Rotation matrix is obtained by


replacing the rotation angle 𝜽 with its negative − 𝜽.
.

19

You might also like