Computer Graphics
Computer Graphics
Computer Graphics
CG-6284
GEOMETRICAL
TRANSFORMATIONS
position,
orientation &
DTEIT 19/8/
CG-6284
GEOMETRICAL
TRANSFORMATIONS
Example
A city planning application program would use
translation to place symbols for buildings &
trees at appropriate
positions,
DTEIT 19/8/
CG-6284
GEOMETRIC
TRANSFORMATIONS
CHANGES IN
ORIENTATION,
SIZE AND
DTEIT 19/8/
CG-6284
GRAPHICS TRANSFORMATIONS
Computer graphics system is the ability to
simulate both
the movement and
the manipulation of the objects in the plane.
These process are described in terms of
translations,
rotations,
scaling and
reflections.
DTEIT 19/8/
CG-6284
GEOMETRIC TRANSFORMATIONS
viewpoint
is
described
by
geometric
DTEIT 19/8/
CG-6284
GEOMETRIC TRANSFORMATIONS
plane.
CG-6284
OBJECT
P(X,Y)
DTEIT 19/8/
CG-6284
GEOMETRIC TRANSFORMATIONS
DTEIT 19/8/
CG-6284
GEOMETRIC TRANSFORMATIONS
Y
1
P(1,1/2 )
1/2
O
DTEIT 19/8/
1
CG-6284
X
10
BASIC TRANSFORMATIONS
BASIC GEOMETRIC TRANSFORMATION
ARE
1. TRANSLATION,
2. ROTATION,
3. SCALING.
DTEIT 19/8/
CG-6284
11
BASIC TRANSFORMATIONS
TRANSLATION
DTEIT 19/8/
CG-6284
12
DTEIT 19/8/
CG-6284
13
TRANSLATION
If the displacement is given by the
vector
v=txi + tyj ,
The new object point p(x,y) can be
found by applying the transformation tv to
p(x,y)
p=tv(p)
where x=x+tx and y=y+ty
DTEIT 19/8/
CG-6284
14
TRANSLATION
OBJ
P
V
Y
P
OBJ
DTEIT 19/8/
CG-6284
15
TRANSLATING A POINT
TRANSLATING A POINT
FROM POSTION P TO P`
WITH
TRANSLATION
VECTOR T.
p`
T
p
X
p = (x1, x2)
p = (x1, x2)
t = (tx, ty)
DTEIT 19/8/
CG-6284
16
TRANSLATING A POINT
CG-6284
17
MOVING A POLYGON
MOVING A POLYGON FROM POSITION P1 TO
POSITION P2 WITH THE TRANSLATION
VECTOR (4.90, 5.10).
20
20
15
15
10
10
5
5
DTEIT 19/8/
10
15
20
CG-6284
10
15
20
18
TRANSLATING CURVED
SURFACE
Similar methods are used to translate
curved objects.
To change the position of a circle or
ellipse
we translate the center coordinate
and redraw the figure in the new location
DTEIT 19/8/
CG-6284
19
ROTATION
To generate a rotation
DTEIT 19/8/
CG-6284
20
ROTATION
Rotation of an object through
angle about the pivot point (xr,yr)
p
yr
p
xr
DTEIT 19/8/
CG-6284
21
ROTATION
DTEIT 19/8/
CG-6284
22
ROTATION
DTEIT 19/8/
CG-6284
23
ROTATION
(x.y)
r
DTEIT 19/8/
(x.y)
CG-6284
24
ROTATION
In the previous slide ,
r is the constant distance of the point
from the origin ,
angle is the original angular
position of the point from the horizontal ,
and
is the rotation angle.
DTEIT 19/8/
CG-6284
25
ROTATION
Using
standard
trigonometric
identities we can
express
the transformed
coordinates in terms of angles and
x = rcos(+)
= rcos cos- rsin sin
y = rsin(+)
= rcos sin - rsin cos
DTEIT 19/8/
CG-6284
26
ROTATION
The
original co- ordinates
polar coordinate are
of the point
in
x = rcos,
y = rsin
Substituting (2) in (1)
we obtain the trans formation equation for rotating a point at
position (x,y) through an angle q about the origin
DTEIT 19/8/
CG-6284
27
ROTATION
WE CAN WRITE THE ROTATION EQUATION IN THE
MATRIX FORM
P = R.P
WHERE THE ROTATION MATRIX IS
cos-
R =
sinsin
cos
DTEIT 19/8/
CG-6284
28
DTEIT 19/8/
CG-6284
29
WHERE
X=X COS ( )- Y SIN ( ) AND
Y=X SIN ( ) + Y COS ( ).
DTEIT 19/8/
CG-6284
30
Y
OBJ
OBJ
DTEIT 19/8/
CG-6284
31
SCALING
A scaling transformation alters the size of an
object.
This operation can be carried out for polygons
by multiplying the coordinate value (x,y) of each
vertex by scaling factors sx and sy to produce the
transformed coordinates (x,y)
x=x. sx ,
y= y. sy
DTEIT 19/8/
CG-6284
32
SCALING
DTEIT 19/8/
CG-6284
33
SCALING
POINTS CAN BE SCALED BY SX SLONG
THE X AXIS AND SY ALONG THE Y AXIS INTO
NEW POINTS BY MULTIPLICATIONS
x = sx.x,
y = sy.y
DTEIT 19/8/
Sx
0
0
Sy
OR
P = S . P
CG-6284
34
SCALING
Any positive numeric values can be assigned to
the scaling factors sx and sy .
DTEIT 19/8/
CG-6284
35
SCALING
When sx and sy are assingned the same value , a
is often used in
design
Application.
DTEIT 19/8/
CG-6284
36
SCALING
Scaling factors
DTEIT 19/8/
CG-6284
37
SCALING
Turning a square (a)
into a rectangle (b) with
scaling factors
sx=2
and sy=1
DTEIT 19/8/
(a)
(b)
CG-6284
38
DTEIT 19/8/
CG-6284
39
CG-6284
40
1
1/2
1
1
DTEIT 19/8/
P
12
CG-6284
4 X
41
SCALING
If both scaling constants have the
same value s , the scaling
transformation is said to be
homogeneous.
If s< 1, then it is a reduction.
If s >1, it is a magnification
DTEIT 19/8/
CG-6284
42
HOMOGENOUS COORDINATES
To express any 2-D transformation as a
matrix multiplication,
x=xh/h,
y=yh/h
DTEIT 19/8/
CG-6284
43
HOMOGENOUS COORDINATES
A general homogeneous coordinate representation can also
be written as
(h.x, h.y, h).
For 2D geometric transformations,
DTEIT 19/8/
CG-6284
44
HOMOGENOUS COORDINATES
The term homogeneous coordinates is
used in mathematics to refer to the fact of
this representation on Cartesian equation.
DTEIT 19/8/
CG-6284
45
HOMOGENOUS COORDINATES
Equations containing x & y,
such as f(x, y)=0 become homogeneous
equation in the 3 parameters xh, yh & h.
Expressing positions in homogeneous
coordinates allow us to represent all
geometric transformation equations as
matrix multiplication's.
DTEIT 19/8/
CG-6284
46
HOMOGENOUS COORDINATES
For translation, we have :
X
Y
1
DTEIT 19/8/
tx
1 ty
CG-6284
Y
1
47
HOMOGENOUS COORDINATES
P=T(tx, ty).P
with T(tx, ty) as the 3 by 3 translation matrix.
DTEIT 19/8/
CG-6284
48
HOMOGENOUS COORDINATES
Similarly, rotation transformation equation about the coordinate origin are now written as :
or as :
P=R( ).P
cos -sin
X
Y
1
DTEIT 19/8/
sin
0
cos 0
0
CG-6284
Y
1
49
HOMOGENOUS COORDINATES
The rotation transformation operator R(t)
is the 3 x 3 matrix, with rotation parameter
DTEIT 19/8/
CG-6284
50
HOMOGENOUS COORDINATES
Expressed as the matrix multiplication.
X
Y
1
DTEIT 19/8/
sx
sy
CG-6284
Y
1
51
HOMOGENOUS COORDINATES
Or :
p=s(sx, sy).P
CG-6284
52
OTHER
TRANSFORMATIONS
Some packages provide a few
additional transformation that are
useful in certain application.
Two such transformations are
reflection and
shear.
DTEIT 19/8/
CG-6284
53
REFLECTION
REFLECTION :
A reflection is a
transformation that
CG-6284
54
REFLECTION
1
ORIGINAL
POSITION
x
REFLECTED
POSITION
1
REFLECTION OF AN OBJECT ABOUT THE X AXIS.
DTEIT 19/8/
CG-6284
55
REFLECTION
REFLECTION ABOUT THE LINE y=0,
THE x AXIS, IS ACCOMPLISHED WITH
THE TRANSFORMATION MATRIX.
DTEIT 19/8/
-1
1
CG-6284
56
REFLECTION
A REFLECTION ABOUT THE y AXIS
FLIPS
x
COORDINATES
WHILE
KEEPING y COORDINATES THE SAME.
THE MATRIX FOR THIS TRANSFORMATION IS :
DTEIT 19/8/
-1
CG-6284
57
REFLECTION
THE CHANGE IN POSITION OF AN
OBJECT THAT HAS BEEN REFLECTED
ABOUT
THE
LINE
x=0.
THE
EQUIVALENT ROTATION IN THIS CASE
IS 180 DEGREE.
y
ORIGINAL
REFLECTED
Reflection of an
object about the y
axis.
DTEIT 19/8/
POSITION
2
POSITION
2
1
1
3
CG-6284
58
REFLECTION
We flip both the x & y coordinates of a
point by reflecting relative to an axis that is
perpendicular to the xy plane and that
passes through the coordinates origin.
DTEIT 19/8/
CG-6284
-1
59
REFLECTION
y
REFLECTED
POSITION
2
x
1
2
ORIGINAL
POSITION
CG-6284
60
REFLECTION
TO
ENVISION
THE
ROTATION
TRANSFORMATION PATH FOR ITS REFLECTION
1. THE FLAT OBJECT MOVING OUT OF THE xy
PLANE .
2. ROTATING 180 DEGREE THROUGH 3-D
SPACE ABOUT x- AXIS.
3. BACK INTO THE xy PLANE ON THE OTHER
SIDE OF x AXIS.
DTEIT 19/8/
CG-6284
61
CG-6284
62
P(X,Y)
X
P (X, -Y)
DTEIT 19/8/
CG-6284
63
SHEAR
DTEIT 19/8/
CG-6284
64
SHEAR
An x-direction shear relative to the x axis
produced with the transformation matrix .
Which transforms coordinate
positions as
x=x+shx.y
1 shx 0
y=y
0 1 0
0
DTEIT 19/8/
CG-6284
1
65
SHEAR
y
(0,1)
(0,0)
(.5,1)
(1,1)
(1,0)
(0,0)
(1.5,1)
(1,0)
CG-6284
66
INVERSE GEOMATRIC
TRANSFORMATION
Translation :
CG-6284
67
INVERSE GEOMATRIC
TRANSFORMATION
Rotation :
rr, or rotation in the opposite direction.
Scaling :
s-1sx,xy = s1/sx, 1/sy
Mirror reflection :
m-1x= mx and m-1y =my
DTEIT 19/8/
CG-6284
68
COORDINATE
TRANSFORMATION
Suppose that we have two coordinate
systems in the plane.
DTEIT 19/8/
CG-6284
69
COORDINATE
TRANSFORMATION
CG-6284
70
COORDINATE TRANSFORMATION
Y
DTEIT 19/8/
P(X,Y)
(X,Y)
CG-6284
71
COORDINATE TRANSFORMATION
P(x,y)
(x,y)
X
O
DTEIT 19/8/
CG-6284
72
TRANSLATION
If the xy coordinate system is displayed to a new
position,
tv (x, y)
where x=x-tx and y=y-ty
DTEIT 19/8/
CG-6284
73
CG-6284
74
x and
y axes.
DTEIT 19/8/
CG-6284
75
CG-6284
76
OLD UNIT
Y
2
P(2,1)
1
O
DTEIT 19/8/
CG-6284
2
77
1/2
P(2,1/2)
NEW UNIT
O
DTEIT 19/8/
2
CG-6284
X
78
MIRROR REFLECTION
ABOUT AN AXIS
CG-6284
79
DTEIT 19/8/
CG-6284
80
INVERSE COORDINATE
TRANSFORMATION
Each coordinate transformation has
an inverse which can be found by
applying the opposite transformation.
Translations:
t-1v =t-v , translation in the opposite
direction .
DTEIT 19/8/
CG-6284
81
INVERSE COORDINATE
TRANSFORMATION
ROTATION :
SCALING :
S-1SX,SY = S1/SX,1/SY
MIRROR REFLECTION :
CG-6284
82
COMPOSITE
TRANSFORMATIONS
We can set up a matrix for any
sequence of
transformations as a
composite transformation matrix by
DTEIT 19/8/
CG-6284
83
COMPOSITE
TRANSFORMATIONS
FORMING
PRODUCTS
TRANSFORMATION MATRICES
OFTEN REFFFERED TO AS A
CONCATENATION OR
COMPOSITION OF MATRICES.
DTEIT 19/8/
CG-6284
OF
IS
84
TRANSLATION
If two successive translation vectors (tx1, ty1)
and (tx2, ty2) are applied to the coordinate
position p,
CG-6284
85
TRANSLATION
DTEIT 19/8/
CG-6284
86
TRANSLATION
OR
tx2
ty2
tx1
ty1
tx1+tx2
ty1+ ty2
CG-6284
87
ROTATIONS
P = r(r(p}
= {R(r(p
DTEIT 19/8/
CG-6284
88
ROTATIONS
By
multiplying
the
two
rotation
R(r(=r(+
P=r(+p
DTEIT 19/8/
CG-6284
89
SCALING
sy2 0
DTEIT 19/8/
Sx1 0
sy1 0
sx1+sx2
0
0
CG-6284
sy1+sy2 0
0
90
SCALING
OR
S(sx2, sy2) . S(sx1, sy1) = S(sx1. sx2, sy1. sy2)
CG-6284
91
provides
CG-6284
92
CG-6284
93
2.
coordinate origin.
DTEIT 19/8/
CG-6284
94
ORIGINAL
POSITION OF
OBJECT &
PIVOT POINT
TRANSLATION
OF OBJECT SO
THAT PIVOT
POINT(xr1, yr1) IS
ROTATION
ABOUT ORIGIN
AT ORIGIN
TRANSLATION
OF OBJECT SO
THAT PIVOT
POINTIS
RETURNED TO
POSITION
(xr1,
yr1).
DTEIT 19/8/
CG-6284
95
xr
yr
cos
sincos
0
cos
-sin
sincos
0
DTEIT 19/8/
-sin
0
0
xr
yr
CG-6284
96
DTEIT 19/8/
CG-6284
97
coordinates origin.
DTEIT 19/8/
CG-6284
98
DTEIT 19/8/
CG-6284
99
ORIGINAL
POSITION OF
OBJECT &
FIXED POINT
TRANSLATION
OF OBJECT SO
THAT FIXED
POINT(xr1, yr1) IS
SCALE OBJECT
WITH RESPECT
TO ORIGIN
AT ORIGIN
TRANSLATION
OF OBJECT SO
THAT FIXED
POINTIS
RETURNED TO
POSITION
(xr1,
yr1).
DTEIT 19/8/
CG-6284
100
xf
sx 0
-xf
yf
sy
-yf
sx 0
xf (1- sx)
sy
yf(1- sx)
OR
CG-6284
101
GENERAL SCALING
DIRECTIONS
CG-6284
102
GENERAL SCALING
DIRECTIONS
CG-6284
103
GENERAL SCALING
DIRECTIONS
(S2-S1)cossin0
(S2-S1)cossinS1sin2 +S2cos20
0
DTEIT 19/8/
0
CG-6284
1
104
GENERAL SCALING
DIRECTIONS
(1/2, 3/2)
(0, 1)
(2, 2)
(1, 1)
(3/2, 1/2)
(0, 0)
(1, 0)
(0, 0)
CG-6284
105
GENERAL COMPOSITE
TRANSFORMATIONS
A general 2-d transformation ,
representing a combination of
TRANSLATIONS,
ROTATIONS &
DTEIT 19/8/
CG-6284
106
GENERAL COMPOSITE
TRANSFORMATIONS
X
Y
1
DTEIT 19/8/
rsxx
rsyy trsx
rsyx
rsyy trsy
CG-6284
Y
1
107
GENERAL COMPOSITE
TRANSFORMATIONS
The
four
elements
rsij
are
the
SCALING FACTORS.
DTEIT 19/8/
CG-6284
108
GENERAL COMPOSITE
TRANSFORMATIONS
DTEIT 19/8/
CG-6284
109
GENERAL COMPOSITE
TRANSFORMATIONS
e.g. If an object is to be scaled & rotated
about its
then translated.
CG-6284
110
GENERAL COMPOSITE
TRANSFORMATIONS
T(tx, ty).R(xc, yc,S(xc, yc, sx, sy) =
sxcos -sysin
sxsinsycos
0
xc(1-sxcosycsysintx
yc(1-sycosxcsxsinty
CG-6284
A
IS
111
ALGORITHM
IDENTITY-MATRIX(H):- Routine to create the identity
transformation
ARGUMENT
elements.
LOCAL
the H array
BEGIN
DTEIT 19/8/
CG-6284
112
ALGORITHM
FOR I = 1 TO 3 DO
FOR J = 1 TO 2 DO
IF I = J THEN H [I , J]<-- 1
ELSE H [ I ,J]<-- 0;
RETURN;
END;
DTEIT 19/8/
CG-6284
113
ALGORITHM
It has the effect of multiplying the matrix H
on the right by a scaling transformation matrix
of
DTEIT 19/8/
SX
SY
1
CG-6284
114
ALGORITHM
CG-6284
matrix
115
ALGORITHM
LOCAL I for stepping through the array
BEGIN
FOR I = 1 TO 3 DO
BEGIN
H [I, 1]<-- H[I, 1]*SX
H [I, 2]<-- H[I, 2]*SY
END;
RETURN;
END;
DTEIT 19/8/
CG-6284
116
ALGORITHM
For translation TX, TY ,we post-multiply
H by the translation matrix
1
TX
DTEIT 19/8/
TY
1
CG-6284
117
ALGORITHM
Since
the
third
column
of
the
CG-6284
118
ALGORITHM
MULTIPLY-IN-TRANSLATION(TX,TY,H):- Routine
to post-multiply the transformation matrix by a translation
DTEIT 19/8/
CG-6284
119
ALGORITHM
H[3,1]<-- H[3,1] + TX;
H[3,2]<-- H[3,2] + TY;
RETURN;
END;
DTEIT 19/8/
CG-6284
120
ALGORITHM
For a rotation of A radians counter
clockwise, we post-multiply by
COS A
SIN A
-SIN A
COS A
0
DTEIT 19/8/
CG-6284
121
ALGORITHM
argument ,
CG-6284
122
ALGORITHM
MULTIPLY-IN-ROTATION(A, H):- Routine to postmultiply the transformation matrix by a rotation
ARGUMENTS A angle of counterclockwise
rotation
H a 3*2 transformation matrix
LOCAL
S,C the sine and cosine values
I for stepping through the array
TEMP temporary storage of the
first column
DTEIT 19/8/
CG-6284
123
ALGORITHM
BEGIN
C<--COS(A);
S<--SIN(A);
FOR I=1 TO 3 DO
BEGIN
DTEIT 19/8/
CG-6284
124
ALGORITHM
TEMP<--H[I,1]*C-H[I,2]*S;
H[I,2]<--H[I,1]*S+H[I,2]*C;
H[I,1]<--TEMP;
END;
RETURN;
END;
DTEIT 19/8/
CG-6284
125
ALGORITHM
DO-TRANSFORMATION(X,Y,H):- Routine to
transform a point
ARGUMENTS X,Y the coordinates of the point to
be transformed
H a 3*2 transformation matrix
LOCAL
TEMP temporary storage for the new
X value.
DTEIT 19/8/
CG-6284
126
ALGORITHM
BEGIN
TEMP <-- X*H[1,1]+Y*H[2,1]+H[3,1];
Y<-- X*H[1,2]+Y*H[2,2]+H[3,2];
X<--TEMP;
RETURN;
END;
DTEIT 19/8/
CG-6284
127
ALGORITHM
TRANSLATE (TX,TY):-User routine to set
the translation parameters
ARGUMENTS TX,TY the translation amount
GLOBAL
DTEIT 19/8/
CG-6284
128
ALGORITHM
BEGIN
TRNX <-- TX;
TRNY <-- TY;
CALL NEWFRAME;
RETURN;
END;
DTEIT 19/8/
CG-6284
129
ALGORITHM
SCALE(SX,SY):-User routine to set the
scaling parameters
ARGUMENTS SX,SY the scaling factors
GLOBAL
scale parameters
DTEIT 19/8/
CG-6284
130
ALGORITHM
BEGIN
SCLX<-- SX;
SCLY<--SY;
CALL NEWFRAME;
RETURN;
END;
DTEIT 19/8/
CG-6284
131
ALGORITHM
ROTATE (A):- User routine to set the rotation
angle
ARGUMENTS A the rotation angle
GLOBAL
ANGL a place to save the
rotation angle
BEGIN
ANGL<-- A;
CALL NEWFRAME;
RETURN;
END;
DTEIT 19/8/
CG-6284
132
ALGORITHM
BUILD-TRANSFORMATION:-Routine to build the
image transformation matrix
GLOBAL ANGL,SCLX,SCLY, TRNX, TRNY
the
transformation parameters
IMAGE- XFORM a 3*2 array
containing the
image transformation
DTEIT 19/8/
CG-6284
133
ALGORITHM
BEGIN
IDENTITY- MATRIX (IMAGE-XFORM)
MULTIPLY-IN-SCALE(SCLX,SCLY,
IMAGE-XFORM);
MULTIPLY-IN-SCALE
(SCLX,SCLY,IMAGE- XFORM);
DTEIT 19/8/
CG-6284
134
ALGORITHM
MULTIPLY-IN-ROTATION
(ANGL,IMAGE-XFORM);
MULTIPLY-IN-TRANSLATION
(TRNX,TRNY,IMAGE-XFORM);
RETURN;
END;
DTEIT 19/8/
CG-6284
135
ALGORITHM
MAKE-PICTURE-CURRENT:-User routine
to show the current display file
GLOBAL FREE the index of the next free
display- file cell
ERASE-FLAG indicates if frames
should be clear
BEGIN
IF ERASE-FLAG THEN
DTEIT 19/8/
CG-6284
136
ALGORITHM
BEGIN
ERASE;
ERASE-FLAG<--FALSE;
END;
BUILD-TRANSFORMATION;
IF FREE > 1 THEN INTERPRET (1,FREE-1);
DISPLAY;
FREE <-- 1;
RETURN;
END;
DTEIT 19/8/
CG-6284
137
CG-6284
138
DTEIT 19/8/
CG-6284
139
CG-6284
140
Pmax
Pmin
P0
CG-6284
141
EXERCISE 3
Prove that a uniform scaling (Sx = Sy) and
a rotation from a commutative pair of
operations but that, in general, scaling and
rotation are not commutative operations.
DTEIT 19/8/
CG-6284
142
EXERCISE 3
Show that transformation matrix (5-33),
for a reflection about the line y =x, is
equivalent to a reflection relative to the x
axis followed by a counterclockwise
rotation of 90.
DTEIT 19/8/
CG-6284
143
EXERCISE 3
Show that transformation matrix (5-34) for
a reflection about the line y=-x, is
equivalent to a reflection relative to the y
axis followed by a counterclockwise
rotation of 90.
DTEIT 19/8/
CG-6284
144
EXERCISE 3
Determine the form of the transformation
matrix for a reflection about an arbitrary
line with equation y= mx+b
DTEIT 19/8/
CG-6284
145
EXERCISE 3
Determine the sequence of basic
transformations that are equivalent to
the x-direction shearing matrix(5-35).
DTEIT 19/8/
CG-6284
146
EXERCISE 3
Determine the sequence of basic
transformations that are equivalent to
the y-direction shearing matrix (5-36).
DTEIT 19/8/
CG-6284
147
CG-6284
148
DTEIT 19/8/
CG-6284
149
DTEIT 19/8/
CG-6284
150
DTEIT 19/8/
CG-6284
151
2
C(h,k)
1
1
DTEIT 19/8/
2
(A)
CG-6284
x
152
(B)
DTEIT 19/8/
CG-6284
153
(C)
DTEIT 19/8/
CG-6284
154
y
4
3
2
1
1
(D)
DTEIT 19/8/
CG-6284
155
DTEIT 19/8/
CG-6284
156
TWO-DIMENSIONAL VIEWING
viewport
window
WORLD COORDINATE
DEVICE COORDINATE
CG-6284
157
2-D VIEWING
A world coordinate area selected for display is
called a window.
DTEIT 19/8/
CG-6284
158
2-D VIEWING
#.
CG-6284
159
2-D VIEWING
ws2 Window
ws2
Viewport
Viewing
coordinate
window
ws1
Viewport
Monitor1
ws1
Window
TWO-DIMENSIONAL VIEWING
DTEIT 19/8/
CG-6284
Monitor2
160
2-D VIEWING
application,
&
another
window-to-
output
devices.This
mapping
is
called
workstation transformation.
DTEIT 19/8/
CG-6284
161
ASPECT RATIO
#. Since the viewing transformation involves
scaling, undesirable distortions may be
introduced whenever sx
DTEIT 19/8/
CG-6284
162
ASPECT RATIO
These distortions may be
DTEIT 19/8/
CG-6284
163
ASPECT RATIO
If the aspect ratio aw of the window equals the
aspect ratio av of the vieport then sx=sy, and no
distortion occurs.If aw !=
av,
then distortion
occurs. If desired ,
DTEIT 19/8/
CG-6284
164
ASPECT RATIO
In this case we can describe a region within
the viewport, a subviewport, whose aspect
ratio is that of the window.
DTEIT 19/8/
CG-6284
165
ASPECT RATIO
DTEIT 19/8/
CG-6284
166
ASPECT RATIO
DTEIT 19/8/
CG-6284
167
ASPECT RATIO
DTEIT 19/8/
CG-6284
168
12M
(.25, .5)
(.25, .5)
(.5, .2)
12M
DTEIT 19/8/
CG-6284
169
ASPECT RATIO
DTEIT 19/8/
CG-6284
170
1/48 0 0
X
0 1/48 0
0 0 1
=
A SCALING TRANSFORMATION WILL CONVERT OBJECT
COORDINATE UNITS TO NORMALIZED SCREEN COORDINATES.
DTEIT 19/8/
CG-6284
171
ASPECT RATIO
DTEIT 19/8/
CG-6284
172
WINDOW
OBJECT SPACE
IMAGE SPACE
CG-6284
173
ASPECT RATIO
DTEIT 19/8/
CG-6284
174
VIEWPORT
DTEIT 19/8/
CG-6284
175
ASPECT RATIO
DTEIT 19/8/
CG-6284
176
ASPECT RATIO
DTEIT 19/8/
CG-6284
178
TRANSLATE
SCALE
TRANSLATE
VIEWING TRANSFORMATION
DTEIT 19/8/
CG-6284
179
-WXL -WYL
DTEIT 19/8/
(VXH-VXL) /
(WXH-WXL)
0
0
0
(VYH-VYL) /
(WYH-WHL)
CG-6284
0
0
VXL VYL 1
180
VXH-VXL)/
(WXH-WXL)
VXL-WXL(VXH-VXL)/
(WXH-WXL)
DTEIT 19/8/
(VYH-VYL)/
(WYH-WYL)
VYL-WYL(VYH-VYL)/
(WYH-WYL)
CG-6284
181
CLIPPING
DTEIT 19/8/
CG-6284
182
CLIPPING
19/8/
DTEIT
BEFORE
AFTER
CG-6284
183
CLIPPING
CLIP LEFT
CLIP RIGHT
CLIP BOTTOM
DTEIT 19/8/
CG-6284
CLIP TOP
184
CG-6284
185
DTEIT
19/8/
CG-6284
186
Global
WXL-HOLD,WXH-HOLD, WYL-HOLD,WYH-HOLD
CG-6284
187
CG-6284
188
Clip right
Clip bottom
Clip top
Viewing
transform
DTEIT 19/8/
CG-6284
189
CG-6284
190
CG-6284
191
CG-6284
192
CG-6284
193
DTEIT 19/8/
CG-6284
194
CG-6284
195
CG-6284
196
DTEIT 19/8/
CG-6284
197
CG-6284
198
CG-6284
199
DTEIT 19/8/
CG-6284
200
CG-6284
201
CG-6284
202
CG-6284
203
DTEIT 19/8/
CG-6284
204
CG-6284
205
DTEIT
19/8/
CG-6284
206
CG-6284
207
MULTIPLE WINDOWING
Some systems allow the use of multiple
windowing:
CG-6284
208
MULTIPLE WINDOWING
ADVANTAGES:
Every application of a window
transformation allows the user to slice up a
portion of the picture and reposition it on
the screen.
CG-6284
209
WINDOW
VIEW PORT
YWMAX
YVMAX
YWMIN
YVMIN
XWMIN
XWMAX
WORLD COORDINATES
XVMIN
XVMIN
DEVICE COORDINATES
DTEIT
19/8/
CG-6284
210
MC
WC
CONVERT
WORLDCOORDINATES
TO VIEWING
COORDINATES
VC
DC
MAP
NORMALIZED
VIEWPORT TO
DEVICE
COORDINATES
NVC
MAP VIEWING
COORDINATES TO
NORMALIZED VIEWING
COORDINATES USING
WINDOW-VIEWPORT
SPECIFICATIONS
CG-6284
211
y WORLD
WINDOW
1
VIEWPOINT
y0
x0
x WORLD
WORLD COORDINATES
NORMALIZIED DEVICE
COORDINATES
DTEIT 19/8/
CG-6284
212
y WORLD
y WORLD
y
y0
y VIEW
VI
EW
x VIEW
x0
TRANSLATE THE
VIEWING ORIGIN TO
THE WORLD ORIGIN.
DTEIT 19/8/
x WORLD
x WORLD
VI
EW
CG-6284
213
YWMAX
YVMAX
(xw, yw)
(xv, yv)
YWMIN
YVMIN
XWMIN
XWMAX
XVMIN
XVMIN
DTEIT 19/8/
CG-6284
214
WINDOW TO VIEWPORT
COORDINATE TRANSFORMATION
A point at position (xw,yw) in the window
is mapped into position (xv,yv)in the
associated viewport. To maintain the same
relative placement in the viewport as in the
window,we require that:
DTEIT
19/8/
CG-6284
215
WINDOW TO VIEWPORT
COORDINATE TRANSFORMATION
xv-xvmin
xw-xwmin
xvmax -xvmin = xwmax -xwmin
yv-yvmin
yw-ywmin
=
yvmax -yvmin
ywmax -ywmin
xv = xvmin - ( xw - xwmin)sx
yv = yvmin + ( yw - ywmin)sy
DTEIT
19/8/
CG-6284
216
WINDOW TO VIEWPORT
COORDINATE TRANSFORMATION
xvmax -xvmin
sx =
xwmax -xwmin
yvmax -yvmin
sy = yw -yw
max
min
THE CONVERSION IS PERFORMED WITH THE
FOLLOWING SEQUENCE OF TRANSFORMATIONS:
DTEIT
19/8/
CG-6284
217
WINDOW TO VIEWPORT
COORDINATE TRANSFORMATION
CG-6284
218
CLIPPING
CG-6284
219
CLIPPING OPERATIONS
In the following sections, we consider
algorithms for clipping the
following
primitive types :
point clipping.
Line clipping (straight - line
segments).
Area clipping (polygons)
Curve clipping.
Text clipping.
DTEIT 19/8/
CG-6284
220
POINT CLIPPING
Assuming that the clip window is a
rectangle in standard position, we save a
point p = (x,y) for display if the following
inequalities are satisfied:
DTEIT
19/8/
CG-6284
221
LINE CLLIPING
A line clipping procedure
involves
sevaral parts.
DTEIT
19/8/
CG-6284
222
LINE CLLIPING
CG-6284
223
LINE CLLIPING
DTEIT
19/8/
CG-6284
224
WINDOW
BEFORE CLIPPING
WINDOW
AFTER CLIPPING
CG-6284
225
COHEN-SUTHERLAND CLIPPING
line-clipping procedure.
CG-6284
226
LINE CLLIPING
CG-6284
227
LINE CLLIPING
#
DTEIT
19/8/
CG-6284
228
1001
1000
1010
0001
0000
0010
0101
WINDOW
0100
0110
DTEIT 19/8/
CG-6284
229
P2
WINDOW
P2`
P2``
P1`
P3
P3`
P4
P1
DTEIT 19/8/
CG-6284
230
COHEN-SUTHERLAND
LINE CLIPPING ALGORITHM
231
COHEN-SUTHERLAND
LINE CLIPPING ALGORITHM
begin
if pt.x < winMin.x then c[Left]
:= true else c[Left] := false ;
if pt.x > winMax.x then c[Right]
:= true else c[Right] := false ;
if pt.y < winMin.y then c[Bottom]
:= true else c[Bottom] := false;
if pt.y > winMax.y then c[Top]
:= true else c[Top] :=false ;
end ;
{ encode }
DTEIT
CG-6284
19/8/
232
COHEN-SUTHERLAND
LINE CLIPPING ALGORITHM
COHEN-SUTHERLAND
LINE CLIPPING ALGORITHM
begin
reject := false ;
for k := Left to Top do
if { c1[k] and c2[k] } then reject := true
end;
function ptInside { c: Code } : boolean ;
begin
if { c[Left] } or { c[Right] } or
{c[Top]} or { c[Bottom]} then
DTEIT
CG-6284
19/8/
234
COHEN-SUTHERLAND
LINE CLIPPING ALGORITHM
235
COHEN-SUTHERLAND
LINE CLIPPING ALGORITHM
begin
tmp := c1; c1 :=c2; c2 :=tmp;
end;
procedure clipLine (p1,p2 : wcPt2);
var code1, code2 : code ;
done, draw : boolean;
m: real;
begin {clipLine }
done := false;
DTEIT
CG-6284
19/8/
236
COHEN-SUTHERLAND
LINE CLIPPING ALGORITHM
draw := false ;
while not done do
begin
code1 := encode (p1);
code2 := encode (p1);
if accept (code1, code2 ) then
begin
done := true ;
draw := true
DTEIT
CG-6284
19/8/end
237
COHEN-SUTHERLAND
LINE CLIPPING ALGORITHM
else
if reject (code1, code2)then done:=true
else
begin
(insure that p1 is outside window)
if ptInside (code1) then
begin
swapPts (p1,p2);
DTEIT
19/8/
CG-6284
238
COHEN-SUTHERLAND
LINE CLIPPING ALGORITHM
CG-6284
239
COHEN-SUTHERLAND
LINE CLIPPING ALGORITHM
CG-6284
240
COHEN-SUTHERLAND
LINE CLIPPING ALGORITHM
DTEIT
19/8/
CG-6284
241
COHEN-SUTHERLAND
LINE CLIPPING ALGORITHM
end
end;
if draw then
{ draw line from p1 to p2 }
lineDDA (round( p1.x), round(p1.y),
round (p2.x) , round (p2.y))
end; { clipLine }
DTEIT
19/8/
CG-6284
242
COHEN-SUTHERLAND
LINE CLIPPING ALGORITHM
begin
for i:=1to n-1 do clipLine (pts[i] ,pts[I+1]);
clipLine ( pts [n] , pts [1] );
end; { clipCohSuth }
DTEIT 19/8/
CG-6284
243
POLYGON CLIPPING
line-clipping procedure
CG-6284
244
POLYGON CLIPPING
For polygon clipping , we require an
algorithm that will generate one or more
closed areas that are then scan converted for
the appropriate atrea fill. The output of a
polygon clipper should be a sequence of
vertices that defines the clipped polygon
boundries.
DTEIT 19/8/
CG-6284
245
POLYGON CLIPPING
BEFORE CLIPPING
AFTER CLIPPING
CG-6284
246
POLYGON CLIPPING
BEFORE
CLIPPING
AFTER
CLIPPING
DTEIT 19/8/
CG-6284
247
3
2
E4
E6
1
E1
0
E2
E3
2
DTEIT 19/8/
CG-6284
248
CG-6284
249
DTEIT 19/8/
CG-6284
250
CG-6284
251
CG-6284
252
V1
V2
V3
V4
SPLITTING A CONCAVE POLYGON USING THE ROTATIONAL METHOD.
AFTER ROTATING V3 ONTO THE X AXIS, WE FIND THAT V4 IS BELOW
THE X AXIS. SO WE SPLIT THE POLYGON ALONG THE LINE OF V2V3.
DTEIT 19/8/
CG-6284
253
CURVE CLIPPING
Areas with curve boundries can be
clipped with methods similar to line &
polygon clipping.
DTEIT
19/8/
CG-6284
254
CURVE CLIPPING
DTEIT
19/8/
CG-6284
255
CURVE CLIPPING
#
DTEIT 19/8/
CG-6284
256
CURVE CLIPPING
#
CG-6284
257
CURVE CLIPPING
BEFORE
CLIPPING
AFTER
CLIPPING
CG-6284
258
TEXT CLIPPING
CG-6284
259
TEXT CLIPPING
The simplest method for processing
character strings relative to a windows
boundary is to use the all-or-none stringclipping strategy.
DTEIT
19/8/
CG-6284
260
TEXT CLIPPING
#
CG-6284
261
TEXT CLIPPING
character string
DTEIT
19/8/
CG-6284
262
TEXT CLIPPING
#
CG-6284
263
TEXT CLIPPING
A final method for handling text clipping
is to clip the components of individual
charecters. We now treat characters in much
the same way that we treated lines.
DTEIT
19/8/
CG-6284
264
TEXT CLIPPING
#
DTEIT 19/8/
CG-6284
265
TEXT CLIPPING
STRING1
STRING2
BEFORE CLIPPING
STRING2
AFTER CLIPPING
TEXT CLIPPING
STRING1
I
R
ST
STRING3
G2
NG1
R
ST
TRING3
STRING4
BEFORE CLIPPING
STRING4
AFTER CLIPPING
TEXT CLIPPING
STRING1
STRING1
2
G
N
I
R
T
S
BEFORE CLIPPING
ST
AFTER CLIPPING
EXTERIOR CLIPPING
We have considered only procedures for
clipping a picture to the interior of a region.
By eliminating everything outside the
clipping region. What is saved by these
procedure is inside the region.
DTEIT 19/8/
CG-6284
269
EXTERIOR CLIPPING
CG-6284
270
EXTERIOR CLIPPING
#
that
requires
overlaping
pictures.
DTEIT
19/8/
CG-6284
271
EXTERIOR CLIPPING
#
DTEIT 19/8/
CG-6284
272
EXTERIOR CLIPPING
A line p1 p2 that is to be clipped to the
interior of a concave window with vertices
v1 v2 v3 v4 v5. Line p1 p2 can be clipped in
two passes
#
DTEIT
19/8/
CG-6284
273
EXTERIOR CLIPPING
#
DTEIT 19/8/
CG-6284
274
NORMALIZED VIEW
VOLUMES
CG-6284
275
NORMALIZED VIEW
VOLUMES
Modeling
coordinates
Modeling
transformation
World
Coordinates
Projection
Transformation
Projection
Coordinates
Workstation
Transformation
Device
Coordinates
Viewing
Transformation
Normalization
Transformation
Viewing
Coordinates
Normalized
Projection
Coordinates
PHIGS Transformation
DTEIT Expanded
19/8/
CG-6284 Pipeline
276
NORMALIZED VIEW
VOLUMES
Then, the parallelepiped is mapped into the
unit cube, a normalized view volume called
the normalized projection coordinate
system.The mapping to normalized
projection coordinates is accomplished by
transforming points within the rectangular
parallelepiped into a position within a
specified three-dimensional viewport,which
occupies part or all of the unit cube.
DTEIT
19/8/
CG-6284
277
NORMALIZED VIEW
VOLUMES
#
DTEIT 19/8/
CG-6284
278
NORMALIZED VIEW
VOLUMES
A similar transformation sequence is used
in other graphics packages,with individual
variation depending on the system.The GL
package, for example, maps the rectangular
parallelepiped into the interior of a cube
with boundary planes at position +-1in each
coordinate direction.
DTEIT 19/8/
CG-6284
279
NORMALIZED VIEW
VOLUMES
ADVANTAGES: The normalized view volume provides a standard
shape for representing any sized view volume.
CG-6284
280
NORMALIZED VIEW
VOLUMES
The depth cueing and visiblesurface determination are simplified,
since the z axis always points toward
the viewer .
DTEIT 19/8/
CG-6284
281
NORMALIZED VIEW
VOLUMES
Mapping positions within a rectangular
view volume to a three-dimensional
rectangular viewport is accomplished with a
combination of scaling and translation,
similar to the operations needed for a twodimensional window-to-viewport mapping .
DTEIT 19/8/
CG-6284
282
NORMALIZED VIEW
VOLUMES
Kx
Dy
Ky
Dz
Kz
DTEIT
19/8/
CG-6284
(12.33)
283
NORMALIZED VIEW
VOLUMES
#
DTEIT
19/8/
CG-6284
284
(XWMAX,YWMAX,ZBACK)
(XWMIN,YWMIN,ZFRONT)
PARALLELPIPED
VIEW VOLUME
(xvmax,yvmax,zvmax)
X
Z
DTEIT 19/8/
(xvmin,yvmin,zvmin)
Unit cube
CG-6284
3d view point
285
VIEWPORT CLIPPING
CG-6284
286
VIEWPORT CLIPPING
DTEIT
19/8/
CG-6284
287
VIEWPORT CLIPPING
dimensional viewport , as
CG-6284
288
VIEWPORT CLIPPING
For two dimensional clipping,we used a
four digit binary region code to identify the
position of a line endpoint relative to the
viewport boundaries.For three dimensional
points we need to expand the region code to
six bits.
DTEIT
19/8/
CG-6284
289
VIEWPORT CLIPPING
DTEIT 19/8/
CG-6284
290
VIEWPORT CLIPPING
#
if x>xvmax(right)
Bit 3=1,
if y<yvmin(below)
DTEIT
19/8/
CG-6284
291
VIEWPORT CLIPPING
Bit 4=1,
if y>yvmax(above)
Bit 5=1,
if z<zvmin (front)
Bit 6=1,
if z>zvmax (back)
DTEIT 19/8/
CG-6284
292
VIEWPORT CLIPPING
CG-6284
293
VIEWPORT CLIPPING
The remaining part of the line is checked
against the other planes, and we continue
until either the line is totally discarded or a
section is found inside the volume.
DTEIT 19/8/
CG-6284
294
VIEWPORT CLIPPING
Equations for three dimensional line
segments are conveniently expressed in
parametric form. The two dimensional
parametric clipping methods of cyrus-beck
or liang-barsky can be extended to three
dimensional scenes.
DTEIT 19/8/
CG-6284
295
VIEWPORT CLIPPING
# We can write the parametric line equations
as
X= x1 + (x2-x1)u, 0<=u<=1
Y= y1 + (y2-y1)u
Z= z1 + (z2-z1)u
Coordinates (x,y,z) represents any point on
the line between the two endpoints.At
u=0,we have the point p1, and u=1 puts us
at p2.
DTEIT 19/8/
CG-6284
296
VIEWPORT CLIPPING
# To find the intersection of a line with a plane of
the viewport, we substitute the coordinate value
for that plane into the appropriate parametric
expression.for instance,suppose we are testing a
line against the zvmin plane of the viewport.then
u=zvmin -z1/z2-z1
DTEIT
19/8/
CG-6284
297
VIEWPORT CLIPPING
when the calculated value for u is not in the
range from 0 to 1, the line segment does not
intersect the plane under consideration at any
point between endpoints p1 and p2.if the
calculated value for u is in the interval from 0
to 1,we calculate the intersections x and y
coordinates as
x1= x1+ (x2-x1) (zvmin-z1)/z2-z1
y1= y1+ (y2-y1)(zvmin-z1)/z2-z1
DTEIT 19/8/
CG-6284
298
CLIPPING IN HOMOGENEOUS
COORDINATES
Although we have discussed the clipping
procedures in terms of three dimensions
coordinates, PHIGS and other packages
actually represent coordinate positions in
homogeneous coordinates. This allows the
various transformations to be represented as 4
by 4matrices, which can be concatenated for
efficiency.
DTEIT 19/8/
CG-6284
299
CLIPPING IN HOMOGENEOUS
COORDINATES
#
DTEIT 19/8/
(x,y,z,1)
CG-6284
300
y
Cross section of
3-dimensional
viewport
Pa2
yvmax
A
Pa1
B
yvmin
Pb2
Pb1
zvmin
zvmax
Side view of two line segments that are to be clipped against the Zvmin
plane of the viewport . For line A, eq-12-37 produces a value of u that is
outside the range from 0 to 1. For line B, eqs-12-38 produce intersection
coordinates that are outside the range from YVmin to Yvmax.
DTEIT
19/8/
CG-6284
301
a11
a21
a31
a41
a12
a22
a32
a42
a13
a23
a33
a43
a14
a24
a34
a44
x
y
z
1
(12-39)
CG-6284
302
CLIPPING IN HOMOGENEOUS
COORDINATES
Clipping then performed in homogeneous
coordinates, and clipping homogeneous positions
are converted to nonhomogeneous coordinates in
three
dimensional
normalized-projection
coordinates.
DTEIT
19/8/
CG-6284
303
CLIPPING IN HOMOGENEOUS
COORDINATES
x` = xh/h , y` = yh/h , z` = zh/h
(12-40)
DTEIT
19/8/
CG-6284
304
CLIPPING IN HOMOGENEOUS
COORDINATES
Occur, if the transformations are carried out
properly. At the final stage in the transformation
pipeline the normalized point is transformed
to a three-dimensional device coordinate point.
The XY position is plotted on the device, and the
Z component is used for depth-information
processing.
DTEIT
CG-6284
305
19/8/
CLIPPING IN HOMOGENEOUS
COORDINATES
#
DTEIT 19/8/
CG-6284
306
CLIPPING IN HOMOGENEOUS
COORDINATES
#
CG-6284
307
CLIPPING IN HOMOGENEOUS
COORDINATES
#
DTEIT
19/8/
CG-6284
308
CLIPPING IN HOMOGENEOUS
COORDINATES
representation are set up in homogeneous
coordinates with arbitrary values for the
homogeneous parameters including h<1.
Negative values for the homogeneous
parameter
can
also
be
generated
in
perspective projections,
DTEIT
19/8/
CG-6284
309
CLIPPING IN HOMOGENEOUS
COORDINATES
when coordinate positions are behind the
projection reference point. This can occur
in applications where we might want to
move inside of a building or other object to
view its interior.
DTEIT 19/8/
CG-6284
310
CLIPPING IN HOMOGENEOUS
COORDINATES
(12.41)
311
CLIPPING IN HOMOGENEOUS
COORDINATES
Thus the homogeneous clipping limits are
hxv min <= xh<= hxv max
hyv min <= yh <= hyv max
hzv min <= zh <= hzv max
if h >0
if h <0
DTEIT
19/8/
CG-6284
(12.42)
312
CLIPPING IN HOMOGENEOUS
COORDINATES
And clipping is carried out with procedures
similar to those discussed in the previous
sections. To avoid applying both sets of
inequalities in 12-42, we can simply negate
the coordinates for any point with h<0 and
use the clipping inequalities for h>0.
DTEIT 19/8/
CG-6284
313
DTEIT 19/8/
CG-6284
314
COMPUTER ANIMATION
Some typical applications of computer
generated animation are entertainment ,
advertising, scientific and engg. Studies and
training and education. We tend to think of
animation as implying object motions , the
term computer animation generally refers to
any time sequence of visual changes in a scene.
DTEIT 19/8/
CG-6284
315
COMPUTER ANIMATION
In addition to changing object postion with
translation or rotations , a computer
generated animation could display time
variations
in
object
size,
colour
CG-6284
316
COMPUTER ANIMATION
CG-6284
317
COMPUTER ANIMATION
And we can produce computer
animations by changing lighting effects or
other parameters associated with
illumination and rendering.
DTEIT 19/8/
CG-6284
318
COMPUTER ANIMATION
require
realistic
representation
of
displays.An
at
the
shape
accurate
of
DTEIT 19/8/
CG-6284
319
COMPUTER ANIMATION
DTEIT 19/8/
CG-6284
320
DESIGN OF ANIMATION
SEQUENCES
DTEIT 19/8/
CG-6284
321
DESIGN OF ANIMATION
SEQUENCES
CG-6284
322
DESIGN OF ANIMATION
SEQUENCES
Object definitions: An object definition is given for each
participant in the action. Objects can be
defined in terms of basic shapes, Such as
polygons.The associated movements for
each object are specified along with the
shape.
DTEIT 19/8/
CG-6284
323
DESIGN OF ANIMATION
SEQUENCES
Key frame specifications:A key frame is a detailed drawing of
the scene at a certain time in the
animations sequence. Within each
key frame, each object is positioned
according to the time for that frame.
DTEIT 19/8/
CG-6284
324
DESIGN OF ANIMATION
SEQUENCES
Key frame specifications: Some key frames are chosen at extreme
in the action; others are spaced so that the
time interval between key frames is not too
great.More key frames are specified for
intricate motions than for simple, slowly
varing motions.
DTEIT 19/8/
CG-6284
325
DESIGN OF ANIMATION
SEQUENCES
Generation of in-between frames:In-between are the intermediate frames
between the key frames. The number of inbetweens needed is determined by the
media to be used to display the animation.
DTEIT 19/8/
CG-6284
326
DESIGN OF ANIMATION
SEQUENCES
Generation of in-between frames: Film requires 24 frames per second, and
graphics terminals are refreshed at the rate
of 30to 60 frames per second. Depending
on the speed specified for the motion, some
key frames can be duplicated.
DTEIT 19/8/
CG-6284
327
DESIGN OF ANIMATION
SEQUENCES
Generation of in-between frames:
DTEIT 19/8/
CG-6284
328
CG-6284
329
CG-6284
330
RASTER ANIMATIONS
On raster systems, we can generate realtime animation in limited applications using
raster operations.To rotate a block of pixels,
we need to determine the percent of area
coverage for those pixels that overlap the
rotated block.
DTEIT 19/8/
CG-6284
331
RASTER ANIMATIONS
We can also animate objects along twodimensional motion paths using the colortable transformations. Here we predefine
the object at successive positions along the
motion path, and set the successive blocks
of pixel values to color-table entries.
DTEIT 19/8/
CG-6284
332
COMPUTER-ANIMATION
LANGUAGES
Design and control of animation
sequences are handled with a set of
animation routines. A general purpose
language, such as C, LISP, PASCAL, or
FORTRAN is often used to program the
animation functions, but several specialized
animation languages have been developed.
DTEIT 19/8/
CG-6284
333
COMPUTER-ANIMATION
LANGUAGES
Animation functions include a graphics
editor, a key frame generator, an inbetween generator and standard
graphics routines.
The graphics editor allows us to design
and modify objects shapes, using spline
surfaces, constructive solid-geometry
methods.
DTEIT 19/8/
CG-6284
334
COMPUTER-ANIMATION
LANGUAGES
DTEIT 19/8/
CG-6284
335
ANIMATOR
Definition:
Animator defines the motion of
the models,cameras, and lighting
according to storyboards and
experience.
DTEIT 19/8/
CG-6284
336
ANIMATOR
The animator must:
Understand the structure and
intricacies of the model.
Be familiar with the principles
and practice of photography,
lighting, and film direction.
DTEIT 19/8/
CG-6284
337
ANIMATOR
The animator must:
Have the ability to breathe life
into the scene through realistic,
fluid motion.
DTEIT 19/8/
CG-6284
338
ANIMATOR
3D Software Recommendations
Suggestions for the best software
packages:More interested in simpler,
designer images, a package with
more shader options and nicer
rendering may be in order.
DTEIT 19/8/
CG-6284
339
ANIMATOR
3D Software Recommendations
Artists needing a moderately
priced tool for Mac or PC 3D
illustration work should weigh
truespace2 alongside others at or
below its price point.
DTEIT 19/8/
CG-6284
340
ANIMATOR
`3D Software Recommendations
In the mid-range, LightWave is
available for several different
platforms.The moderately priced
Mac package Strata StudioPro is a
good choice.
DTEIT 19/8/
CG-6284
341
ANIMATOR
Choosing a Hardware platform:
There are three major platforms for
3D graphics, namely PC,Mac and
Unix-type workstations.
DTEIT 19/8/
CG-6284
342
ANIMATOR
Choosing a Hardware platform:
Besides shopping for a particular
manufacturer and model of system
you also should investigate the
peripherals and cards provided.
DTEIT 19/8/
CG-6284
343
ANIMATOR
Choosing a Hardware platform:
The heart of any computer is
printed circuit card called the
motherboard,
which
contains
numerous electronic components, such
as CPU which is brain of the system.
DTEIT 19/8/
CG-6284
344
ANIMATOR
Choosing a Hardware platform
Two main considerations of
processors are architecture and
speed.Chip architecture refers to
the internal design of the processor.
DTEIT 19/8/
CG-6284
345
ANIMATOR
Choosing a Hardware platform
The second consideration is
clock speed, which is basically
how fast a processor executes
instructions, it is measured in
millions of cycles per second.
DTEIT 19/8/
CG-6284
346
ANIMATOR
Choosing a Hardware platform
In addition to processor, there
are other chipsets on PC
motherboards that can affect
performance.Final consideration is
tech support.
DTEIT 19/8/
CG-6284
347
ANIMATOR
SGI/Unix
Silicon Graphics Workstations
have long been considered the
ultimate platform for creating
computer graphics.
DTEIT 19/8/
CG-6284
348
ANIMATOR
SGI/Unix
SGI Workstations hold the top
position in computer graphics due
to their speed and advanced
scaleable
3D
acceleration
hardware.
DTEIT 19/8/
CG-6284
349
ANIMATOR
SGI/Unix
There are also high-powered Unix
workstations as well, including the
Sun SparcStation, DEC alpha, IBM
RS6000,
and
others.
DTEIT 19/8/
CG-6284
350
ANIMATOR
PC:
The PC is the overwhelming
winner in the desktop computer wars.
They are relatively inexpensive,
going for less than $1,000 for a
decent P5/133 to about $6,000.
DTEIT 19/8/
CG-6284
351
ANIMATOR
Macintosh:
The Macintosh has been a
substantial rise in computing power,e
specially since Apple finally started
licensing its architecture and OS to
third parities.
DTEIT 19/8/
CG-6284
352
ANIMATOR
Platform Recommendations:
The right platform to buy is one
that runs the software you want.
DTEIT 19/8/
CG-6284
353
ANIMATOR
Platform Recommendations:
The PC is most popular platform,
and the intense competition among
manufacturers keeps driving the
price/performance ratios at a
breakneck pace.
DTEIT 19/8/
CG-6284
354
ANIMATOR
Choosing Peripherals:
Every computer system needs
some peripheral devices to be truly
usable, be it a monitor, hard drive
or other mass storage device,
printer or modem.
DTEIT 19/8/
CG-6284
355
ANIMATOR
Choosing Peripherals:
Peripherals, such as cartridge hard
drives and modems are available in
either
internal
or
external
configurations, means that you either
install them inside your CPU or in
their own enclosure.
DTEIT 19/8/
CG-6284
356
ANIMATOR
Choosing Peripherals:
CG-6284
357
ANIMATOR
Choosing Peripherals:
Hard Drive Basics: Hard drives
were a bulky, expensive rarity, and
practically unheard of for desktop
systems.
DTEIT 19/8/
CG-6284
358
ANIMATOR
Choosing Peripherals:
Hard Drive Basics: Are sealed
units containing a motor that spins a set
of metal disks called magnetic
platters.A read/write head, moves back
and forth reading and writing data with
a set of electromagnetic pulses.
DTEIT 19/8/
CG-6284
359
ANIMATOR
Choosing Peripherals:
Hard Drive Basics: There are five
terms that will gauge drive performance:
Seek Time:The maximum time it
takes to move the read/write head to a
specific location on the disk.
DTEIT 19/8/
CG-6284
360
ANIMATOR
Choosing Peripherals
Track-to-track seek time: The time it
takes to move the read/write head from
one track to another.
Data transfer rate: The maximum rate
at which information is delivered from
the drive to computer.
DTEIT 19/8/
CG-6284
361
ANIMATOR
Choosing Peripherals
CG-6284
362
ANIMATOR
Choosing Peripherals
Cartridge: Is a storage system that
uses removable media to store data.The
cartridge have magnetic platters in
them just like regular hard drive.
DTEIT 19/8/
CG-6284
363
ANIMATOR
Choosing Peripherals
Optical Media: Magneto-Optical
drives are another form of cartridgebased
storage
that
offered
comparatively
high
storage
capabilities.
DTEIT 19/8/
CG-6284
364
ANIMATOR
Choosing Peripherals
CG-6284
365
ANIMATOR
Choosing Peripherals
Video display Cards: The video
display card is responsible for
converting the text and graphics data in
the computer into a form that the
computer monitor can display.
DTEIT 19/8/
CG-6284
366
ANIMATOR
Choosing Peripherals
Video display Cards:
Video card Recommendation: Choice of
graphics card depend on motherboard,
because you will want to use the fastest bus
available
DTEIT 19/8/
CG-6284
367
ANIMATOR
Choosing Peripherals
Display: Computer display is the
most overlooked component in the
system.For 3D and graphic arts, a 15
monitor should be considered minimum
size, with 17 or larger desirable.
DTEIT 19/8/
CG-6284
368
ANIMATOR
Choosing Peripherals
Trackball.
Flying Mice.
Spaceballs.
Dial boxes.
Graphics tablets: One of them are Pressuresensitive tablets.
DTEIT 19/8/
CG-6284
369
ANIMATOR
Input Devices:
DTEIT 19/8/
CG-6284
370
ANIMATOR
Animation basics: Animation is
modifying any kind of object,
light, material or camera by
moving or changing it overtime.
DTEIT 19/8/
CG-6284
371
ANIMATOR
Animation basics
Frame Rates:The speed at which
the images are displayed is called
the frame rate and is measured in
frames per second.
DTEIT 19/8/
CG-6284
372
ANIMATOR
Animation basics
Keyframing: To control animation
most programs use a method called
keyframing, in which you pose
your objects in key positions at
specific frames.
DTEIT 19/8/
CG-6284
373
ANIMATOR
Animation basics
Motion Paths: A useful capability
in 3D programs is the ability to work
directly with the motion path of an
object, which is a graphical
representation of its movement.
DTEIT 19/8/
CG-6284
374
ANIMATOR
Animation basics
CG-6284
375
ANIMATOR
Animation basics
CG-6284
376
ANIMATOR
Animation basics
Links : A link is a connection
between two objects so that
animation affecting one also
influences the other.
DTEIT 19/8/
CG-6284
377
ANIMATOR
Animation basics
One object is called the parent
and movement applied to it is
transferred to the second is called
child.
DTEIT 19/8/
CG-6284
378
ANIMATOR
Animation basics
Chains: A chain is a series of
linked objects,using the same
parent and child relationship,but
extending
it
by
additional
generations to grandchild and so.
DTEIT 19/8/
CG-6284
379
ANIMATOR
Animation basics
nulls:Nulls or dummy objects
are used as invisible components
chain or as reference points for
establish remote axes for rotation.
DTEIT 19/8/
CG-6284
380
ANIMATOR
Animation basics
CG-6284
381
ANIMATOR
Animation basics
Inverse Kinematics: Is a method
of controlling linked objects by
moving the end of the chain and
having the rest of it conform.
DTEIT 19/8/
CG-6284
382
ANIMATOR
Animation basics
CG-6284
383
ANIMATOR
Animation basics
Morphing: Animation is a
technique that allows smooth
changes to occur to an objects shape
by defining beginning, end and
possibly intermediate forms as target.
DTEIT 19/8/
CG-6284
384
ANIMATOR
Animation basics
Deformation Grids:Space Wraps
are a means of defining an area in
3D space that has an automatic
effect on objects passing through
its influence.
DTEIT 19/8/
CG-6284
385
ANIMATOR
Animation basics
Particle Systems: These are 3D
animation modules that enable you
to generate and control the
behavior of vast number of tiny
objects.
DTEIT 19/8/
CG-6284
386
ANIMATOR
Animation basics
Procedural
motion: The
movement of particle systems is
sometimes
referred
to
as
procedural motion.
DTEIT 19/8/
CG-6284
387
ANIMATOR
Character Animation:
CG-6284
388
ANIMATOR
previous .
DTEIT 19/8/
CG-6284
389
ANIMATOR
CG-6284
390
ANIMATOR
CG-6284
391
ANIMATOR
CG-6284
392
ANIMATOR
DTEIT 19/8/
CG-6284
393
394
3
2
E4
E6
1
E1
0
E2
E3
2
DTEIT 19/8/
CG-6284
395
DTEIT 19/8/
CG-6284
396
DTEIT 19/8/
CG-6284
397
PARALLEL PROJECTION
In a parallel projection, parallel lines in the
world-coordinate scene project into parallel
lines on the two-dimensional display playing.
This technique is used in engineering and
architectural drawings tools to represent and
object with set of views that maintain relative
properties of the object .
DTEIT 19/8/
CG-6284
398
PARALLEL PROJECTION
TOP
SIDE
FRONT
DTEIT 19/8/
CG-6284
399
PARALLEL PROJECTION
The appearance of the solid object can then
be reconstructed from the major views.
In the perspective projection, parallel lines
in a scene that are not parallel to display plane
are projected into converging lines.
DTEIT 19/8/
CG-6284
400
DEPTH CUEING
With few exceptions, depth information is
important so that we can easily identify, for a
particular viewing direction, which is the front
and which is the back of displayed objects.
DTEIT 19/8/
CG-6284
401
DEPTH CUEING
DTEIT 19/8/
CG-6284
402
DEPTH CUEING
Depth cueing is used in modeling the
effect of atmosphere on the perceived
intensity of objects .
Some atmospheric effects can change
the perceived color of an object, and we
can model these effects with depth cueing.
DTEIT 19/8/
CG-6284
403
CG-6284
404
SURFACE RENDERING
DTEIT 19/8/
CG-6284
405
SURFACE RENDERING
Surface properties of objects include degree
of transparency and how rough or smooth
the surfaces are to be.
Procedures can then be applied to generate
the correct illumination and shadow
regions for the scene.
DTEIT 19/8/
CG-6284
406
CG-6284
407
DTEIT 19/8/
CG-6284
408
DTEIT 19/8/
CG-6284
409
DTEIT 19/8/
CG-6284
410
CG-6284
411
THREE-DIMENSIONAL
DISPLAY METHODS
To obtain a display of a three dimensional
scene that has been modeled in world coordinates, we must first set up a coordinate
reference for a camera.
This coordinate reference defines the
position and orientation for the plane of the
camera film, which is the plane we want to use
to display a view of the object in the scene.
DTEIT 19/8/
CG-6284
412
THREE-DIMENSIONAL
DISPLAY METHODS
Object descriptions are then transferred to the
camera reference coordinates and projected onto
the selected display plane.
We can then display the objects in wire
frame form or we can apply lighting and surfacerendering techniques to shade the visible
surfaces.
DTEIT 19/8/
CG-6284
413
THREE-DIMENSIONAL
DISPLAY METHODS
DTEIT 19/8/
CG-6284
414
COORDINATE
PRESENTATIONS
Refresh
display
Picture
Definition in
World
Coordinates
Normalized
Coordinates
Device
coordinates
Plotter
Other
displays
Ymax
1
x
0
DTEIT 19/8/
0
CG-6284
Xmax
415
COORDINATE
PRESENTATIONS
DTEIT 19/8/
CG-6284
416
VIEWING IN 3-D
3D WORLD
COORDINATE
OUTPUT PRIMITIVES
CLIPPED
WORLD
COORDINATES
CLIP AGAINST
VIEW
VOLUME
PROJECT ONTO
PROJECTION
PLANE
2D DEVICE
COORDINATES
TRANSFORM
INTO VIEWPORT
IN 2D DEVICE
COORDINATES
FOR DISPLAY
VIEWING IN 3-D
In 3d viewing, we specify a view volume in
the world, a projection on to a projection plane,
& a viewport on the view surface. Conceptually,
objects in 3d world are clipped against the 3d
view volume & are then projected. The contents
of the projection of the view volume onto the
projection plane called the window, are then
transformed into the viewport for display.
DTEIT 19/8/
CG-6284
418
CG-6284
419
MOTION
WINDOW
SCIENCE
ZPRP=0
DTEIT 19/8/
ZV
VIEW PLANE
CG-6284
420
GENERAL PARALLEL
PROJECTION TRANSFORMATION
We obtain the oblique-projection transformation
with a shear operation that converts the view
volume to the regular parallelepiped.
The elements of the shearing transformation
needed to generate the view volume are obtained
by considering the shear transformation of the
projection vector.
DTEIT 19/8/
CG-6284
421
VP
VIEW VOLUME
DTEIT 19/8/
CG-6284
422
WINDOW
VP
VIEW VOLUME
DTEIT 19/8/
CG-6284
423
GENERAL PARALLEL
PROJECTION TRANSFORMATION
Suppose the elements of the projection vector in
coordinates are
vp=(px,py,pz).
We need to determine the elements of a shear matrix
that will align the projection vector vp with the view
plane normal vector n. This transformation can be
expressed as
VP=MPARALLEL.VP
DTEIT 19/8/
CG-6284
424
0
0
=
PZ
0
1 0 a 0
MPARALLEL=
0 1 b 0
0 0 1 0
0 0 0 1
DTEIT 19/8/
CG-6284
425
GENERAL PARALLEL
PROJECTION TRANSFORMATION
The explit transformation equations from
12-20 in terms of shear parameters a and b are
0 = px + apz
0 = py + bpz
So that the values for the shear parameters are
a= - px/pz, b= -py/pz
DTEIT 19/8/
CG-6284
426
GENERAL PARALLEL
PROJECTION TRANSFORMATION
Thus,we have the general parallelprojection matrix in terms of the elements
of the projection vector as
1 0 -PX/PZ 0
MPARALLEL=
DTEIT 19/8/
0 1 -PY/PZ 0
0 0
0 0
1
CG-6284
427
GENERAL PARALLEL
PROJECTION TRANSFORMATION
This matrix is then concatenated with
CG-6284
428
GENERAL PARALLEL
PROJECTION TRANSFORMATION
We can relate the components of the
projection vector to parameters l,
and
phi.By similar triangles,we see that
l cos /z = - px/pz
L sin /z = - py/pz
which illustrate the equivalence of the
elements of transformation matrices 12-10
and 12-24.
DTEIT 19/8/
CG-6284
429
(XP,YP,0 )
VP
PY
PZ
PX
(X,Y,O)
DTEIT 19/8/
XY
CG-6284
ZY
430
GENERAL PERSPECTIVE
PROJECTION TRANSFORMATION
With the PHIGS programming standard,
the projection reference point can be
located at any position in the viewing
system,except on the view plane or
between the front and back clipping planes.
DTEIT 19/8/
CG-6284
431
GENERAL PERSPECTIVE
PROJECTION TRANSFORMATION
The figure shows the shape of a finite
view volume for an arbitrary position of the
projection reference point.
DTEIT 19/8/
CG-6284
432
GENERAL PARALLEL
PROJECTION TRANSFORMATION
We can obtain the general perspective
projection
transformation
with
the
following two operations:
DTEIT 19/8/
CG-6284
433
GENERAL PARALLEL
PROJECTION TRANSFORMATION
Scale the view volume with a scaling
factor that depends on 1/z.
The second step (scaling the view volume)
is
equivalent
to
the
perspective
transformation.
DTEIT 19/8/
CG-6284
434
ZY
VIEW PLANE
CENTER OF WINDOW
DTEIT 19/8/
(XPRP,YPRPCG-6284
,ZPRP)
435
GENERAL PARALLEL
PROJECTION TRANSFORMATION
This transformation has the effect of
shifting all positions that lie along the
frustum centerline ,including the window
center ,to a line perpendicular to the view
plane.With the projection reference point at
a general position (xprp,yprp,zprp),the
transformation involves a combination zaxis shear and a translation:
DTEIT 19/8/
CG-6284
436
GENERAL PARALLEL
PROJECTION TRANSFORMATION
MSHEAR =
DTEIT 19/8/
-azprp
-bzprp
CG-6284
437
GENERAL PARALLEL
PROJECTION TRANSFORMATION
Where the parameters are :
a= (-xprp-(xwmin+xwmax)/2)/zprp
b= (-yprp-(ywmin+ywmax)/2)/zprp
Points within the view volume are
transformed by this operation as
the zp axis, xprp= yprp= 0
DTEIT 19/8/
CG-6284
438
GENERAL PARALLEL
PROJECTION TRANSFORMATION
x= x + a(z-zprp)
y= y + b(z-zprp)
z= z
when the projection reference point is on
DTEIT 19/8/
CG-6284
439
View plane
Center of window
(xprp,yprp,zprp)
DTEIT 19/8/
CG-6284
440
GENERAL PARALLEL
PROJECTION TRANSFORMATION
The complete transformation from world
coordinates to perspective projection
coordinates is obtained by right
concatenating m perspective with the
composite viewing transformation R.T
DTEIT 19/8/
CG-6284
441
PARALEL PROJECTION
We have talked about creating and transforming
three-dimensional objects, but since our viewing
surface is only two-dimensional, we must have some
way of projecting our three -dimensional object onto
the two -dimensional screen.
DTEIT 19/8/
CG-6284
442
PARALEL PROJECTION
Perhaps the simplest way of doing this is
just to discard the z coordinate. This is a
special case of a method known as parallel
projection. A parallel projection is formed
by extending parallel line from each vertex
on the object until by they intersect the plan
of the screen.
DTEIT 19/8/
CG-6284
443
PARALEL PROJECTION
Y AXIS
X AXIS
3 D OBJECT
Z AXIS
DTEIT
19/8/
CG-6284
444
PARALEL PROJECTION
Y AXIS
X AXIS
PROJECTION OF OBJECT
A THREE- DIMENSIONAL OBJECT AND ITS PROJECTION
DTEIT 19/8/
CG-6284
445
CG-6284
446
CG-6284
447
CG-6284
448
CG-6284
449
DTEIT 19/8/
CG-6284
450
PROJECTIONS
Perspective
One principal
vanishing point
Parallel
Oblique
Projectors not
perpendicular
Two principal
vanishing point
Three principal
vanishing point
DTEIT 19/8/
to projection
plane
Orthographic
Projectors not
perpendicular
to projection plane
Multiview Axonometric
Projection
Projection
General
plane llel to
plane not llel
principal
to principal
Cavalier
planes
planes
Isometric, Dimetric
Cabinet Three views ,
Trimetric 451
CG-6284
Auxiliary
views
PERSPECTIVE PROJECTION
BASIC PRINCIPLES:The techniques of perspective projection are
generalizations of the principles used by artists
in preparing perspective drawings of threedimensional objects and scenes. The eye of the
artists is placed at the center of projection,and
the canvas,or more precisely the plane
containing the canvas,becomes the view plane
DTEIT 19/8/
CG-6284
452
PERSPECTIVE PROJECTION
An image point is located at the intersection of
a projector with the view plane.
Perspective drawings are characterized by
perspective foreshortening and vanishing
points.
Perspective foreshortening is the illusion that
objects and lengths appear smaller as their
distance from the center of projection increases.
DTEIT 19/8/
CG-6284
453
PERSPECTIVE PROJECTION
The illusion that certain sets of parallel lines
appear to meet at a point is another feature of
perspective drawings. These points are called
vanishing points.
Principle vanishing points are formed by the
apparent intersection of lines parallel to one of
the three principle x,y,or z axes.
The no. of principle vanishing points is
determined by the no. of principle axes
intersected by the view plane.
DTEIT 19/8/
CG-6284
454
PERSPECTIVE PROJECTION
EXAMPLE:-The standard perspective projection.
The view plane is the xy plane , and the center of
projection is taken as the point C(0,0,-d) on the
negative z axis.
Using similar triangles ABC and A 0C , we find
x`=d*x/z+d
y`=d*y/z+d
z`=0
DTEIT 19/8/
CG-6284
455
PERSPECTIVE PROJECTION
The perspective transformation between
objects and image point is nonlinear & so
cannot be represented as a 3*3 matrix
transformation.
However , if we use homogeneous
coordinates, the perspective transformation
can be represented as a 4*4 matrix:
DTEIT 19/8/
CG-6284
456
PERSPECTIVE PROJECTION
X`
Y`
D* X
=
Z`
1
D* Y
0
0 0
D 0
1 D
Z+D
CG-6284
457
PERSPECTIVE ANOMALIES
The process of constructing a perspective
view introduces certain anomalies which
enhance realism in turns of depth cues but
also distort actual sizes and shapes.
Perspective foreshortening:- The farther an
object is from the center of projection, the
smaller it appears.
DTEIT 19/8/
CG-6284
458
PERSPECTIVE ANOMALIES
Vanishing point:-Projections of lines that
are not parallel to the view plane(i.e.,lines
that are not perpendicular to the view plane
normal) appear to meet at some point on
view plane. A common manifestation of
this anomaly is the illusion that railroad
tracks meet at a point on the horizon.
19/8/
DTEIT
CG-6284
459
PERSPECTIVE ANOMALIES
VIEW PLANE
Y
C(0,0,-D)
CG-6284
460