This preview shows page 1. Sign up to view the full content.
Unformatted text preview: rld 0. 5
p2 · vlocal
p3 1 Local coordinate frame (source) expressed in global coordinates (target). x
y and vectors v = y Transforms points p = z z
ECS 175 Chapter 4: Object Transformation 50 Review of Tuesday
• Origin of current coordinate system is fixed point Identical transformation matrix has different effects based on relative
position of the object and coordinate origin. ECS 175 Chapter 4: Object Transformation 51 Review of Tuesday
• More complex operations can be performed by concatenating transformations. For example:
vworld = T (p)Rz (α)T (−p) · vlocal
Rotation around arbitrary point (2D) A = T ( p) R x ( − β 1 ) R y ( − β 2 ) R z ( α ) R y ( β 2 ) R x ( β 1 ) T ( − p)
Rotation around arbitrary axis (3D) ECS 175 Chapter 4: Object Transformation 52 Sequences of Transformations
• How do we interpret a sequence of transformation matrices?
• We can read transformations from right to left or from
left to right • Reading from right to left: Interpret operations as being performed in (fixed) world coordinate system.
• Reading from left to right: Interpret operations as being performed in (dynamic) object coordinate system.
ECS 175 Chapter 4: Object Transformation 53 Object Transformation
• The vertex processor transforms vertices by applying transformation of current transformation matrix setTransformationMatrix(matrix1)
renderObject(object1) //matrix1 is active setTransformationMatrix(matrix2)
renderObject(object2) //matrix2 is active
Pseudo code Caution when using OpenGL matrix operations (OpenGL <3.0):
OpenGL does matrix post-multiplication as opposed to pre-multiplication.
ECS 175 Chapter 4: Object Transformation 54 Coordinate Transformations - Summary
• Homogeneous coordinates allow us to
• Incorporate local coordinate system origins (translation)
• Distinguish points and vectors
• Do a full transform between coordinate systems • Important notions
• Points are different from vectors (cf. vertices and normals)
• Order of transformations matters
• Rotation and translation are rigid-body transformations
• Programming: be aware of row-major vs. column major matrices ECS 175 Chapter 4: Object Transformation 55 Chapter 4 - Summary
• Object geometry (vertices and connectivity) is passed to the graphics pipeline together with transformation operations
• Transformation operations are represented by matrices
• Objects are transformed by applying the transformation to each of its vertices (vertex processor does this in parallel)
• The transformed objects need to be projected into a 2D coordinate system and mapped to the screen
(“Where do objects end up on screen?” - next chapter)
ECS 175 Chapter 4: Object Transformation 56...
View Full Document
- Spring '08