chapter4 (2)
chapter4 (2)
Two Dimensional
Viewing
Model
Model: a pattern, plan,
representation, or description
designed to show the structure
or working of an object,
system, or concept.
Modeling
Modeling is the process of
creating, storing and
manipulating a model of
an object or a system.
Modeling
In Modeling, we often use a geometric
model
i.e.. A description of an object that provides a
numerical description of its shape, size and
various other properties.
Modeling
The shape of the object is often
described in terms of sub-parts, such as
circles, lines, polygons, or cubes.
Example: Model of a house units are in
meters
y
6 x
Instances of Objects
Instances of this object may then be
placed in various positions in a scene, or
world, scaled to different sizes, rotated,
or deformed.
Each house is created with instances of
the same model, but with different
y
parameters.
9
x
2D Viewing
2D Viewing
Viewing is the process of
drawing a view of a
model on a
2-dimensional display.
Viewing and Transformation
Once a model has been constructed, the
programmer can specify a view.
Viewport
Scene Image
2D Geometric
Transformations
2D Geometric Transformations
Operations that are applied to the
geometric description of an object to
change its position, orientation or size.
Basic transformation:
Translation
Rotation
Scaling
2D Translation
2D Translation: Move a point along a
straight-line path to its new location.
x x t x , y y t y
y
x x t
P’ x
T
y y t
P y
x
P P T
2D Tranlation
Rigid-body translation: moves objects
without deformation (every point of the object is
translated by the same amount)
Y 6
5 4
4
4
tx = 2 3
ty = 3 2
2
1 1
0
1 2 3 4 5 6 7 8 9 10
X
Note: House shifts position relative to origin
Matrix Representations
And
Homogeneous Coordinates
Matrix Representations
In Modeling, we perform sequences of
geometric transformation: translation,
rotation, and scaling to model components
into their proper positions.
Result
2D Scaling
2D Scaling: Alters the size of an object.
x x
2D Scaling
x x s x , y y s y
x s x 0 x
y 0
s y y
P S P
y sx 2 y
sy 1
x x
2D Scaling
Any positive numeric values can be assigned to the
scaling factors.
Values less than 1 reduce the size of objects, and
greater than 1 produce an enlargement.
Uniform Scaling: s s
x y
s s
x y s s
x y
Result
2D Rotation
2D Rotation: Rotate the points a specified
rotation angle about the rotation axis.
yr
xr
2D Rotation
Simplify: rotate around origin: x 0, y 0
r r
cosθ sin θ
( x' , y ' )
R
sin θ cosθ
P R P
2D Rotation
Rigid-body translation: Rotates objects
without deformation (every point of the object
is rotated through the same angle.
Y 6
5
6
4
1
0
1 2 3 4 5 6 7 8 9 10
X
Example 3-Rotation
P’= * =
Matrix Representations
and
Homogeneous Coordinate
Basic 2D transformations as 3x3 matrices:
x 1 0 t x x x cos sin 0 x
y 0 1 t y y sin cos y
y
0
1 0 0 1 1 1 0 0 1 1
Translation Rotation
x s x 0 0 x
y 0 s 0 y
y
1 0 0 1 1
Scaling
Assignment 1:
y y y
1 1 1’ 1’
2 3 2 3 3’ 2’ 3’ 2’
x x x
2’ 3’ 1 3
1’
2