Académique Documents
Professionnel Documents
Culture Documents
Lina Saeed
Introduction
Preliminary ideas
No
implementation
Yes
2
First Lecture Introduction Msc. Lina Saeed
Operating system
Application
software
CAD model
database Graphics User
utility interface
Device drives
Input-Output
devices
4
Second Lecture Computer Graphics Msc.Lina Saeed
Computer Graphics
1
Second Lecture Computer Graphics Msc.Lina Saeed
Transform
Vectorize to viewport Clip Draw
(vxr − vxl )
xs = ( xw − wxl ) + vxl
( wxr − wxl )
(v yt − v yb )
ys = ( y w − w yb ) + v yb Fig.(2.2) Display tolerance.
( w yt − w yb )
2
Second Lecture Computer Graphics Msc.Lina Saeed
xs = axw+b
ys = cyw+d
The value of a, b, c and d may be computed when the window and viewport are defined,
so each point (generally a line end) may be transformed by a computation involving only
two multiplication and two additions.
Example 1
A circle of radius 25 mm, centered at (100, 150), is to be drawn as a series of lines by two
diminution drafting system. The max. tolerance is 1 mm. Cacluate the nu7mbers of lines
required to display the circle within this tolerance, and calculate the screen coordinates of
the first of the lines. The window bounds are (40, 100) and (160, 200), and the viewport
bound are at pixel locations (0, 50), (480, 450).
Solution:
3
Second Lecture Computer Graphics Msc.Lina Saeed
2.2.3 clipping:
When the window only shows a part of the model, then those vectors outside the
window may lead to undesirable effects if mapped to the screen – they might, for
example, write over a text area of the screen, or over another window, or have their
coordinates set to the screen boundary values. In any case, it is necessary to identify
quickly and efficiently which vectors or parts of vectors are within the window, and to
discard the rest.
4
Second Lecture Computer Graphics Msc.Lina Saeed
example2:
An arc is defined in the Oxy plane of a coordinate system Oxa ya za and centered at
(100, 100, 0). Oxa ya za is rotated by 45ْ anticlockwise about the Oxa -axis with respect to
the system Oxw yw z w . The origin of Oxa ya za is at (50, 0, 0) in Oxw yw z w and the Ox -axes of
the two systems are coincident. Evaluate the transformation matrices required in the
generation of vectors in Oxw yw z w for display of the arc.
5
Second Lecture Computer Graphics Msc.Lina Saeed
6
Third Lecture Geometric Transformations Msc.Lina Saeed
Geometric Transformations
follows:
x′ = x + d x and y′ = y + d y (3.1)
1
Third Lecture Geometric Transformations Msc.Lina Saeed
we will have
V′ =V + D (3.2)
dy
dx
Fig.(3.1)
Example1:
In Fig.(3.1), suppose the initial coordinates of vertices A, B, C are (1,3), (4,5), (5, 3.5),
respectively by distance vector D = [7,−2]T (where T represents transpose). Verify that the
lengths of the edges of the triangle are unchanged.
Solution
2
Third Lecture Geometric Transformations Msc.Lina Saeed
• Scaling : scaling in two dimension means stretching the points in the x-y plane. It can
be accomplished by simple multiplications. As follows:
x′ s 0 x
V ′ = [ S ]V or = x (3.4)
y′ 0 sy y
Example2:
From Fig.(3.2), shows that the length of edge A′B ′ is equal to three times that of AB after
scaling the object uniformly by factor 3.
Solution:
3
Third Lecture Geometric Transformations Msc.Lina Saeed
• Rotation: rotation in two dimension space is defined as moving any point (x,y) of an
object to a new position by rotating it through a given angle θ about some reference
point. Positive angles are measured counterclockwise from x to y. the mathematical
expression for the rotation transformation is not as obvious as the formulas for
translation and scaling. In order to have a clear understanding we provide a derivation
here.
From Fig.(3.3), in which a point V ( x, y ) is rotated to V ′( x ′, y ′) through angle θ about
some origin, by simple trigonometry we have
x = r cos φ
y = r sin φ
V ′( x′, y ′)
θ
V ( x, y )
φ
x
4
Third Lecture Geometric Transformations Msc.Lina Saeed
Example3:
Determine the new position of object A placed on around holding table after the table has
been rotated by 35ْ .
Solution:
By substituting by θ , x and y in equation (3. ) values 35ْ , 347.3792, and 149.0298 cm,
respectively, we have
point V ′( x ′, y ′, z ′) .
• Scaling: If S is scaling coefficient matrix.
• Rotation: the rotation of an object could be about any of the axes.
3.5 Homogeneous Representation
Although the 2D and 3D transformations have obvious geometric meaning, it is not
efficient or economical to implement them on a computer. This is because translation
involves addition of matrices whereas scaling and rotations are performed by their
multiplication. It is, however, posiable to develop what is called a homogenous
transformation scheme, which required only multiplications of matrices in all cases. This
simplifies the transformation process. A homogenous representation scheme is widely
used in transformation computations. In the geometric transformations methods discussed
previously (translation, scaling and rotation) have nonuniform equations as follows:
V′=V + D
5
Third Lecture Geometric Transformations Msc.Lina Saeed
V ′ = [ S ]V
V ′ = [ R ]V
V ′ = [ H ]V
Solution
6
Fourth Lecture Geometric Transformations Msc.Lina Saeed
Geometric Transformations
3.7 Three-Dimensional Rotation about Line
• Line pass through the Origin:
Rotation object (point, line, surface) about line pass through origin with angle of rotation
(α ) is provided by applying right hand rule. Then the rotation process defining with the
6. calculate V ′ .
ax
Example 1
The two endpoints of a line are (1,2,3), and (5,3,2). This line is rotated by (30ْ ) ccw with
respect to a line defined by points (0,0,0), and (10,7,4). Find the coordinates of the
endpoints of the transformed line.
Solution:
1
Fourth Lecture Geometric Transformations Msc.Lina Saeed
example 2:
The two endpoints of a line are (1,2,3), and (5,3,2). This line is rotated by (30ْ ) ccw with
respect to a line defined by points (1,1,3), and (10,7,4). Find the coordinates of the
endpoints of the transformed line.
Solution:
2
Fourth Lecture Geometric Transformations Msc.Lina Saeed
1. Reflection in x-axis
2. Reflection in y-axis
3. Reflection through the Origin
4. Reflection in line pass through the Origin
example3:
line points are(1,3) and (2,2) is reflected about line (0,0) ,(3,4). Find the coordinates of
the endpoints of the reflected line.
3
Fourth Lecture Geometric Transformations Msc.Lina Saeed
Example 4
reflect the point (50,60) through a line at an angle of (30ْ )to the x-axis with its origin at
x=16, y=24.
Solution:
• Reflection in xz plane.
x′ = x 1 0 0
y′ = − y R fxz = 0 − 1 0
z′ = z 0 0 1
• Reflection in xy plane.
x′ = x 1 0 0
y′ = y R fxy =0 1 0
z′ = −z 0 0 −1