TOPIC 3
Computer Graphics Transformations
Overview of Transformations
Transformations: Processes that change the representation of objects in computer graphics, particularly useful for 3D.
Types of Transformations: Key types include:
- Affine Transformations which include:
- Scaling
- Translation
- Rotation
- Shearing
Example of Affine Transformations
Visual Representation:
- A house demonstrates transformations through scaling, rotation, and translation.
- Display of results before and after transformations in both 2D and 3D spaces.
Applications of Transformations
Coordinate Systems
Arch Design: Creation of an arch in its own coordinate system, utilized multiple times at various locations and sizes in scene design.
3D City Models: Compositions of cubes to represent urban structures.
Snowflake Design
Symmetry Utilization: A single motif is designed and replicated 12 times using transformations like reflections, rotations, and translations.
Camera Positioning
3D Vantage Points: Affine transformations enable changing the camera’s position and orientation to view objects from different angles.
Computer Animation
Movement Representation: Objects in animations move through the transformation of their local coordinate systems by translating and rotating.
- Supported by platforms like OpenGL, which implement a graphics pipeline for consistent processing and display of points.
The OpenGL Graphics Pipeline
Simplified Version:
Point Processing: An application sends points (e.g. P1, P2,…) through commands:
-glBegin(GL_LINES); glVertex3f(...); // Send P1 glVertex3f(...); // Send P2 glEnd();Current Transformation (CT): The points undergo a transformation to produce new points (e.g. Q1, Q2,…) reflecting any changes.
Final Representation
The transformed points Q represent the geometric image of the original points P when drawn on the display.
Types of Transformations
Transformations change points/vectors or redefine coordinate systems.
Object Transformation: Alters object coordinates while keeping the coordinate system fixed.
Coordinate Transformation: Establishes a new coordinate system based on the original one.
Definition of Transformation
Given a transformation function , it alters points from to new points :
-
Coordinate Frame Description
A coordinate frame has:
- Origin (O): A point of reference.
- Axes (i and j): Mutually perpendicular vectors in 2D, adding k in 3D.Point representation: .
Affine Transformations
Matrix Representation
Compact matrix representation is essential:
- Must be represented as a 3x3 matrix in 2D using homogeneous coordinates.
Transformation Form
Points transformed as linear combinations:
- Q = egin{pmatrix} m_{11} & m_{12} & m_{13} \ m_{21} & m_{22} & m_{23} \ 0 & 0 & 1 \ ext{ } \ ext{ } \ ext{ } \ ext{ } \ ext{ } \ ext{ } \ ext{ } \ ext{ } \ ext{ } \ ext{ } \ ext{ } \ ext{ } \ ext{ } \ ext{ } \ ext{ } \ ext{ } \ ext{ } \ ext{ } \ ext{ } \ ext{ } \ ext{ } \ ext{ } \ ext{ } \ ext{ } \ ext{ } \ ext{ } \ ext{ }egin{pmatrix} P_x \ P_y \ 1 \ ext{ } \ ext{ } \ ext{ } \ ext{ }egin{pmatrix} P \ P_y \ 1 \ ext{ } \ ext{ }egin{pmatrix} P_y & O \ ext{ } \ ext{ } \ ext{ }egin{pmatrix} Q \ P \ P_y \ 1 \ ext{ }
eturn
Transformation on Vectors
Vectors also transform using a similar matrix, represented as a column vector with third component zero.
Transformation Example
Example transformation using matrix on point P = (1, 2, 1)QPabQ = egin{pmatrix} P_x + a \ P_y + b \ 1 \ ext{ }egin{pmatrix} P \ a \ b \ ext{ } \ ext{ }egin{pmatrix} P_y \ P_x + a \ 1 \ ext{ } \ ext{ }egin{pmatrix} 0 + 0 + 1 \ 1 \ ext{ } \ ext{ }egin{pmatrix} 0 \ 1 \ 2 \ 3 \ 6
1 \ 8 \ 17 \ 18 \ 7 \ 2 \ ext{ } \ ext{ }egin{pmatrix} 2; 5 \ ext{ }egin{pmatrix} 0 \ 1 \ 2 + 3 \\ 15\ n=28,48 \ P_x = ext{translated by a, -1} + 1 = 2 = -6xx = P_x \ 0 = P_x + z \ P = 7; P = 13 \ \ 0; P_{y+} = 36 \ \ R = ext{inversely translated}\ 15 = ext{affine point}
n \\
Scaling
Definition: Scaling affects the object based on the origin; non-uniform scalings can produce distortion.
Reflection: If scalars are negative, reflections occur across respective axes.
Scaling Matrix:
- Q = egin{pmatrix} S_x & 0 & 0 \ 0 & S_y & 0 \ 0 & 0 & 1 \ ext{ }egin{pmatrix} (0)\ 1 \ 0; 1|1 1 \ P_x \ Pegin{pmatrix} = rac{S( ext{xy)}} \ ext{ } \ ext{ }egin{pmatrix} = egin{pmatrix} rac{y_5|P}{p_y}{ P}, which results in Q {P_(1|1)} rather thanegin {pmatrix} 1)} (f_P \ 0 \ 0 \ }….
Types of Scaling
Reflection: Occurs with
+1 or −1scale factors.Differential scaling: Scale factors differ; results in imagery distortion.
Modes of scaling: Uniform scaling magnifies; |S| < 1 reduces size.
Rotation
Counterclockwise Rotation: Around the origin by angle hetaQ = egin{pmatrix} ext{cos}( heta) & - ext{sin}( heta) & 0 \ ext{sin}( heta) & ext{cos}( heta) & 0 \ 0 & 0 & 1 \ ext{ }egin{pmatrix} 0 \ 1 \ 0 \ 1 \ \ 3 |||egin{pmatrix} = ext {identity matrix}. \\ sin heta/ cos \ theta \ P = \ Q. Having defined scalar and multiple; absolute zeros to investigate for Triangle mesh}
Here are 20 multiple-choice questions (MCQs) related to Computer Graphics Transformations:
What is the purpose of transformations in computer graphics?
A) Create new colors
B) Change the representation of objects
C) Store objects
D) None of the above
Answer: BWhich of the following is NOT a type of affine transformation?
A) Scaling
B) Translation
C) Rotation
D) Color adjustment
Answer: DIn which transformation does an object change size?
A) Translation
B) Rotation
C) Scaling
D) Reflection
Answer: CWhat does the translation transformation do?
A) Changes the shape of an object
B) Moves an object from one location to another
C) Alters the color of an object
D) Rotates an object around its center
Answer: BAffine transformations can be composed of which basic transformations?
A) Shearing and scaling
B) Rotation and translation
C) All of the above
D) None of the above
Answer: CWhen transforming a point using a scaling matrix, what does a negative scaling factor do?
A) Makes the object larger
B) Makes the object smaller
C) Reflects the object across an axis
D) Rotates the object
Answer: CWhat is the output when a point is translated by (a, b)?
A)
B)
C)
D) None of the above
Answer: AWhich of the following transformations can change the shape of an object?
A) Translation
B) Rotation
C) Shearing
D) Both B and C
Answer: CHow many dimensions does a 3x3 matrix operate in?
A) 1D
B) 2D
C) 3D
D) Both B and C
Answer: DWhat type of transformation does not affect the overall shape of the object?
A) Scaling
B) Translation
C) Shearing
D) None of the above
Answer: BWhat is the matrix representation for a rotation around the origin by an angle ?
A)
B)
C)
D) None of the above
Answer: BWhich of the following is NOT a property of affine transformations?
A) Maintain collinearity
B) Preserve distances
C) Preserve parallelism
D) All transformations can be represented as a matrix
Answer: BWhat does the OpenGL command
glBegin(GL_LINES);indicate?
A) Starting point specification for lines
B) Ending point specification for lines
C) Beginning of line vertex definitions
D) None of the above
Answer: CIn graphics, what does the term 'shearing' refer to?
A) Changing the height of an object
B) Changing the angle between lines in a shape
C) Moving an object to a different location
D) Rotating an object around its axis
Answer: BWhat is the effect of applying multiple transformations sequentially?
A) They have no effect on the object
B) They cannot be combined
C) They can produce more complex transformations
D) They always produce the same output
Answer: CWhat is the main function of the graphics pipeline in OpenGL?
A) Execute calculations for 3D rendering
B) Control the lighting effects
C) Manage input devices
D) Display the source code
Answer: AHow do affine transformations assist in computer animation?
A) By adding sound to animations
B) By changing the color of objects
C) By representing movement through coordinate changes
D) By calculating inverse kinematics
Answer: CWhich of the following does NOT describe an object's local coordinate system?
A) Fixed to the object
B) Changes with object movement
C) Independent of global coordinates
D) Completely defines object attributes
Answer: DIn which scenario is a transformation matrix particularly useful?
A) When determining a digital object's texture
B) When performing operations on pixel color values
C) When calculating 3D point transformations
D) All of the above
Answer: CWhich of the following correctly describes object transformation?
A) Changes the coordinate system and the object
B) Changes object coordinates while keeping the coordinate system fixed
C) Establishes a new coordinate system
D) None of the above
Answer: B
These questions cover various aspects of computer graphics transformations to help assess understanding of the subject.