Lecture 4 Transformations and Matrices
Lecture 4 Transformations and Matrices
and Matrices
CSE 40166 Computer Graphics (Fall
2010)
Overall Objective
Instancing!
Graphics... how does it work?
Dot Product
Cross Product
Affine Space
Curves
Surfaces
An object is convex iff for any two points in the object, all
points on the line segment between these points are also in the
object.
convex non-convex
Convex Hull
Linear Independence
If a set of vectors is linearly independent, we cannot represent one in
terms of the others:
Dimension
Given a basis v1, v2, ... vn, any vector v can be written: v = a1v1 + a2v2
+ ... + anvn
Coordinate Systems
a = Cb = MTb
where
P' = P + d
Translation Matrix
P' = P + d
Rotation (about an axis)
P' = SP
Scaling Matrix
p' = ABCDp
p'T = pTCTBTAT
OpenGL Matrices
GL_MODELVIEW
GL_PROJECTION
GL_TEXTURE
GL_COLOR
glMatrixMode(GL_MODELVIEW);
Current Transformation Matrix (CTM)
glLoadIdentity() C <- I
glLoadMatrix(M) C <- M
glPushMatrix()
glPopMatrix()
Instancing
glPushMatrix();
glTranslatef(i->x, i->y, 0.0);
glRotatef(i->angle, 0.0, 0.0, 1.0);
glScalef(10.0, 10.0, 1.0);
glCallList(DisplayListsBase + MissileType);
glPopMatrix();