انت هنا الان : شبكة جامعة بابل > موقع الكلية > نظام التعليم الالكتروني > مشاهدة المحاضرة

TWO-DIMENSIONAL TRANSFORMATIONS 1

الكلية كلية تكنولوجيا المعلومات     القسم قسم شبكات المعلومات     المرحلة 2
أستاذ المادة الاء شوقي جابر علي شعابث       29/12/2015 07:01:17


Assist. Lecturer: Alaa shawqi jaber



LECTURE SIX
TWO-DIMENSIONAL TRANSFORMATIONS
Computer Graphics First semester , second stage

Outlines:

.2D-Transformation Definition
.Translation
.Scaling
.Rotation






.2D (two-dimension)-Transformation means altering the
coordinate descriptions of two-dimension objects. By using
appropriate coordinate transformation on the object the
image will be manipulated. The basic geometric
transformations are:
1.Translation (shift or move).
2.Scaling.
3.Rotation.





2D-Transformation Definition

.A translation is a straight-line movement of an object from
one position to another.
.Consider a point p(x,y). Translated this point means shift it to
a new postion p´(x´,y´) by adding translation distances, Tx
and Ty, to the original coordinates position (x,y):


x´= x+Tx

y´= y+Ty

.Translation is a rigid-body transformation that is move
objects without deformation. Every point on the object is
translated by the same amount.


Translation:

.The translation distance pair (Tx,Ty) is also called a
translation vector or shift vector.
.The translation equation can performed as a single matrix
equation by using column vectors or row vectors to represent
coordinate positions and the translation vector.




P=
..
.. , T =
....
.... , p´ =
..´
..´



.Geometric transformation for 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
coordinates of each vertex and regenerating the polygon
using the new set of vertex coordinates and the current
attribute settings.
.To change the position of a circle or ellipse, we translate the
center coordinates and redraw the figure in the new location.



.Translation distances can be specified as any real numbers
(positive, negative, or zero).
.In screen coordinate system the translation factor will be:


If Tx>0 then point moves to the right.

If Tx<0 then point moves to the left.

If Ty>0 then point moves to the down.

If Ty<0 then point moves to the up.

.Using Cartesian coordinate system the translation factor will be:


If Tx>0 then point moves to the right.

If Tx<0 then point moves to the left.

If Ty>0 then point moves to the up.

If Ty<0 then point moves to the down.

Notes:

This figure Translate the
object from position (a) to
position (b) with translation
distances (-20, 50).
.It is the process that change the size of an object such as
magnify the size or reduce it.
.Suppose P(x,y) is the point that we want to scale and Sx and
Sy are the scaling factors. After scaling we get new point
having coordinates as




....(....,....) ....=x * Sx

....=y * Sy

We multiplying the coordinates values (x,y) by the scaling
factors Sx and Sy.

Scaling

.For example, this operation can be carried out for polygons
by multiplying the coordinate values (x, y) for each boundary
vertex by scaling factors Sx and Sy to produce transformed
coordinates ( ...., ....):


.... =x * Sx, ...... =y * Sy

.The scale equation above can also be written in the matrix
form:


P=
..
.. , S =
....00....
, .... =
....
....


Any positive numeric values can be assigned to the scaling
factors Sx and Sy in which:



.Values less than 1 reduce the size of objects.
. values greater than 1 produce an enlargement.
.Specifying a value of 1 for both Sx and Sy leaves the size of
objects unchanged.
. When Sx and Sy are assigned the same value, a uniform
scaling is produced, which maintains relative proportions of
the scaled object.


Notes:

.Unequal values for Sx and Sy result in a differential scaling
that is often used in design applications, where pictures are
constructed from a few basic shapes that can be modified
by scaling transformations.


Ex. Turning a square (a) into a
rectangle (b) by setting Sx = 2
and Sy = 1.


.If the fixed point is at the origin (0,0), a point (x,y) can be
scaled by a factor Sx in the X direction and Sy in the Y
direction to the point (XF,YF).


Ex. A line scaled with Eqs x =x.Sx,
y =y.Sy and Sx= Sy = 1/2

is reduced in size and moved closer
to the coordinate origin.


.We can control the location of a scaled object by choosing a
position, called the fixed point (Xf, Yf), which is remain
unchanged after the scaling transformation and also it can be
chosen as one of the vertices, the center of the object, or any
other position.
.For standard figures, such as circles and ellipses, these
transformations can be carried out more efficiently by
modifying distance parameters in the defining equations. We
scale a circle by adjusting the radius and possibly
repositioning the circle center.



. A polygon is then scaled relative to the fixed point by scaling
the distance from each vertex to the fixed point. For a vertex
with coordinates (x, y), the scaled coordinates (x , y ) are
calculated as:


.... =xf+(x-xf)Sx, .... =yf+(y-yf)Sy


Ex. Scaling relative to a chosen fixed
point (xf, yf). Distances from each
polygon vertex to the fixed point are
scaled by transformation equations
above.
.Other types of objects could be scaled with these equations by applying
the calculations to each point along the defining boundary.
.It is possible to choose any point (xf,yf) as the fixed point of scaling by
performing the following steps:




1.Translate the point (xf,yf) to the origin (0,0), every point(x,y) become
the new point(x ,y ):
x =x-xf y =y-yf
2.Scale the translated points with the origin as the fixed point:


....=x * Sx ....=y * Sy

3.Translate the origin back to the fixed point (xf,yf):


....= .... + xf ....= .... + yf

These three steps can be combined in the following equation that scales a
point (xf,yf):

.... =(x-xf)Sx + xf

.... =(y-yf)Sy + yf




.Transformation of object points along circular paths is called
rotation.
.The figure below illustrates displacement of a point from
position (x, y) to position (x , y ) relative to the coordinate
origin.
.The original angular position of the point from the x axis is
., so we have:


x = r cos(.), y = r sin(.)






Rotation
After applying a rotation angle O, the
new equations will be:
x =r cos(.+O) , y =r sin(.+O)
.Using these triangles and standard trigonometric identities,
we can write:


x =r cos(.+O)=r cos. cosO – r sin. sinO

y =r sin(.+O)= r sin. cosO + r cos. sinO



.As mentioned before if we have x = r cos(.), y = r sin(.),
after restated in terms of x and y, the rotation equation
relative to the origin coordinate:




x = x cosO - y sinO

y = y cosO + x sinO



.With the column-vector representations, the matrix form for
the rotation equations will be:




P =R* P



R=cos O-sinOsinOcos O
, P=
..
..



P´ =
..´
..´
=
x cosO - y sinO
y cosO + x sinO







.Positive values for O in these equations indicate a
counterclockwise rotation, and negative values for O rotate
objects in a clockwise direction.
.Objects can be rotated about an arbitrary point by modifying
the previews Eqs. to include the coordinates (xr, yr) for the
selected rotation point (or pivot point).
.The transformation equations for the rotated coordinates can
be obtained from the trigonometric relationships in this figure
as:


x =xr+(x-xr)cosO- (y-yr)sinO

y =yr+(y-yr)cosO+(x-xr)sinO


Notes:

Thank you



المادة المعروضة اعلاه هي مدخل الى المحاضرة المرفوعة بواسطة استاذ(ة) المادة . وقد تبدو لك غير متكاملة . حيث يضع استاذ المادة في بعض الاحيان فقط الجزء الاول من المحاضرة من اجل الاطلاع على ما ستقوم بتحميله لاحقا . في نظام التعليم الالكتروني نوفر هذه الخدمة لكي نبقيك على اطلاع حول محتوى الملف الذي ستقوم بتحميله .