SI460 Graphics RST Transform Concepts v1.0 Homogenous vectors

advertisement
SI460 Graphics
RST Transform Concepts v1.0
Homogenous vectors
“Homogenous transforms” simply
means that all transforms
(Rotate/Scale/Translate) can be done
with the same mechanism.
The last element in a homogenous
vector allows translations for
Location vectors, and ignores them
for Direction vectors.
V2d = [ ] , V3d = [ ] Indicates a Location (e.g. a vertex)
V2d = [ ] , V3d = [ ] Indicates a Direction (e.g. a normal)
Location Vectors
A point in space, e.g. a vertex in a
polygon. Translating the location
moves the point relative to the origin.
[
Direction Vectors
A unit direction in space, e.g. the
normal for a polygon. The direction is
defined by a line from the origin to
the given coordinate. Length is
usually 1.
] [ ]
[
[
] [ ]
]
[ ]
We often store a list of pre-computed
normals with our polygon mesh
objects. Translating a polygon does
not change the normal, though
rotating and scaling may.
Inverse Transform Matrices
The inverse of any transform matrix is
a new matrix that “undoes” the
original transform.
] Rz-1( =[
Rz( =[
]
Rz-1( ) = RzT( )
Use geometry to figure out the three
patterns for generating the inverses.
S=[
T=[
] S-1=[
] T-1=[
]
]
SI460 Graphics
RST Transform Concepts v1.0
Order of transforms matter
AB != BC,
TS != ST,
RT != TR, etc.
S=[
]
T=[
]
ST = [
]
TS = [
]
The right-most transform matrix
applies first
R=[
]
T=[
RT : Translates then Rotates
TR : Rotates then Translates
]
TR
RT
Rotate or Scale an object about
an arbitrary point.
(10,6)
(5,3)
Consider the rectangle above, with corners (5,3) and (10,6).
To rotate it about point (5,3), do the following:
(1) Translate all the vertices by (-5,-3). This puts the rotation
point on the origin.
(2) Rotate the points.
(3) Translate all the vertices by (5,3). This returns the rotationpoint of the rectangle to its original location.
[ ]
[
]
[
]
[ ]
Download