Xem mẫu
- Bài 4 Các phép biến đổi Đồ hoạ
Affine Transformations
I KHái niệm cơ bản
Le Tan Hung
Email: hunglt@it-hut.edu.vn
II Các phép biến đổi
III Hệ tọa độ đồng nhất
(c) SE/FIT/HUT 2002 1
CuuDuongThanCong.com https://fb.com/tailieudientucntt
- Mô hình hoá - Modelling
mô hình - model :
Modeling - Mô hình hoá
Thực thể cơ sở -
object
primitives
như circles, lines polygons
hay cubes
Cảnh - A scene
mô hình hoá cảnh - Scene
Modeling A scene with several instances of the object
(c) SE/FIT/HUT 2002 2
CuuDuongThanCong.com https://fb.com/tailieudientucntt
- Ví dụ
At each frame of the animation, the
object is transformed, in this case by a
rotation. It could also be transformed
by changing its size (scaling), or its
shape (deforming), or its location
(translation).
Further animation effects can be
achieved by not changing the object,
but the way it is viewed (i.e. the
window to viewport transformation) at
each frame (e.g. by zooming).
(c) SE/FIT/HUT 2002
CuuDuongThanCong.com https://fb.com/tailieudientucntt
- Phép biến đổi - Transformations
Trong kỹ thuật đồ hoạ 3 bước: modeling, rendering,
displaying
Với Modeling:
modeling world viewing
coordinate Modeling coordinate Viewing coordinate (eye coordinate)
transformation transformation
Phép biến đổi - Transformation
Biến đổi mô hình hoá - Modeling transformations
Biến đổi tạo góc nhìn - Viewing transformations
Biến đổi tạo Hoạt cảnh - Animation
(c) SE/FIT/HUT 2002 4
CuuDuongThanCong.com https://fb.com/tailieudientucntt
- Transformations - Modeling
world
(c) SE/FIT/HUT 2002 5
CuuDuongThanCong.com https://fb.com/tailieudientucntt
- Viewing
Transformations - Viewing
Viewing
Transformations - Viewing CAMERA
OBJECT
Trong phép biến đổi này :
Một mô hình có thể quan sát
trên các góc cạnh khác nhau
(e.g. faraway, near, looking
down, looking up) WORLD
(c) SE/FIT/HUT 2002 6
CuuDuongThanCong.com https://fb.com/tailieudientucntt
- Phép biến đổi Affine
Affine Transformations?
Phép biến đổi Affine
Ví dụ: phép biến đổi tọa độ với chỉ 2 điểm đầu cuối của
đoạn thẳng tạo thành 2 điểm mới mà khi nối chúng với
nhau tạo thành đoạn thẳng mới.
Các điểm nằm trên đoạn thẳng sẽ có kết quả là điểm
nằm trên đoạn thẳng mới với cùng phép biến đổi thông
qua phép nội suy.
(c) SE/FIT/HUT 2002 7
CuuDuongThanCong.com https://fb.com/tailieudientucntt
- Phân loại - Transformations
Example: OBJECT TRANSFORMATION
Có 2 cách nhìn trên phép
biến đổi
.4, 2
Object Transformation:
Coordinate 1,1
Transformation Example: COORDINATE TRANSFORMATION
Mỗi phương pháp có ưu
nhược điểm riêng về bản
chất tương đồng nhau (1,1)
(1,1)
(c) SE/FIT/HUT 2002
CuuDuongThanCong.com https://fb.com/tailieudientucntt
- Modeling Transformations
Transform objects/points Transform coordinate system
(c) SE/FIT/HUT 2002 9
CuuDuongThanCong.com https://fb.com/tailieudientucntt
- 2D Object Transformations
A 2D object transformation alters each point P into a
new point Q using a specific formula or algorithm.
It therefore alters the co-ordinates of P (Px,Py) into
new values which specify point Q (Qx,Qy)
This can be expressed using some function T, that
maps co-ordinate pairs into co-ordinate pairs:
(c) SE/FIT/HUT 2002
CuuDuongThanCong.com https://fb.com/tailieudientucntt
- Matrix Representation
If affine transformation T maps P onto Q, then Q is related to P as
follows:
where a, b, c, d, tx and ty are all constants, and ad = bc
This gives rise to the following matrix representation:
Qx a b Px t x
i.e. = +
Q P t
y c d y y
(c) SE/FIT/HUT 2002
CuuDuongThanCong.com https://fb.com/tailieudientucntt
- Các phép biến đổi hình học hai chiều
Phương pháp biểu diễn đối tượng P = [ x y ]
Phép biến đổi vị trí điểm a b
T =
c d
Thực thi phép biến đổi đúng trên 1 điểm ảnh sẽ đúng trên toàn bộ đối
tượng
y
pW
pM
x
z
(c) SE/FIT/HUT 2002 12
CuuDuongThanCong.com https://fb.com/tailieudientucntt
- y
Phép biến đổi
Phép bất biến
z x
Phép biến đổi tỉ lệ - Scaling
A scaling changes the size of an object with two scale factors, Sx and Sy
Phép biến dạng
A shearing shears an object in a particular direction, (in 2D, it’s either in the x
or in the y direction
(c) SE/FIT/HUT 2002 13
CuuDuongThanCong.com https://fb.com/tailieudientucntt
- Phép quay- Rotation
y
( x’, y’ )
ρ
( x, y )
ρ
θ
α x
(c) SE/FIT/HUT 2002 14
CuuDuongThanCong.com https://fb.com/tailieudientucntt
- Thuộc tính cơ bản của phép biến đổi
Affine Transformations
Preservation of lines:
Affine transformations map lines to lines;
Preservation of parallelism
Preservation of proportional distances
Affine transformations change volume by |
Det(M) |;
(c) SE/FIT/HUT 2002 15
CuuDuongThanCong.com https://fb.com/tailieudientucntt
- Kết hợp các phép biến đổi
Composition of Affine Transforms
Any affine transformation can be
decomposed into elementary
transformations.
Mọi phép biến đổi phức tạp đều có
thể tạo thành từ các phép biến đổi cơ
sở như:
Dịch chuyển - Translation
Tỉ lệ - Scaling
Quay- Rotation
Biến dạng - Shearing
(c) SE/FIT/HUT 2002
CuuDuongThanCong.com https://fb.com/tailieudientucntt
- Affine transformations preserve
affine combinations
It is rare that we want to perform just one elementary
transformation.
Usually an application requires that we build a complex
transformation out of several elementary ones
e.g. translate an object, rotate it, and scale it, all in one move
These individual transformations combine into one overall
transformation
This is called the composition of transformations.
The composition of two or more affine transformations is
also an affine transformation
(c) SE/FIT/HUT 2002
CuuDuongThanCong.com https://fb.com/tailieudientucntt
- Thuộc tính
T
Tác động lên tập các điểm đặc trưng của đối tượng tạo
thành phép biến đổi cho đối tượng
We have defined each transformation by their effects on single
points
In practice these will be applied to multiple points to transfer
entire scenes or objects made up of many defining points
(c) SE/FIT/HUT 2002 18
CuuDuongThanCong.com https://fb.com/tailieudientucntt
- Điểm gốc - Pivotal points
Cho phép quay và tỉ lệ Rotation and Scaling
The simple versions of rotation and scaling have been based around the origin.
This means that when we rotate or scale, the object will also move, with
respect to the origin
Translate all points through (-c1,-c2)
Rotate all points about the origin by
Translate all points back through (c1,c2)
(c1,c2)
(0,0)
(c) SE/FIT/HUT 2002
CuuDuongThanCong.com https://fb.com/tailieudientucntt
- Pivotal points
Often we wish to rotate or scale with respect to some pivotal
point, not the origin
Most significantly, we often wish to rotate or scale an object
about its centre, or midpoint
In this way, the object’s location does not change
To do this, we relate the rotation or scaling about the pivotal
point V, to an elementary rotation or scaling about the origin
We first translate all points so that V coincides with the origin
We then rotate or about the origin
then all points are translated back, so that V is restored to its original
location
(c) SE/FIT/HUT 2002
CuuDuongThanCong.com https://fb.com/tailieudientucntt
nguon tai.lieu . vn