Geometric Transformations UBI 516 Advanced Computer Graphics Aydın Öztürk
Two Dimensional Geometric Transformations
Basic Transformations Translation P P'P' x y
Basic Transformations Rotation x y θ φ P′=(x′,y′) r
Rotation (Cont.) Basic Transformations
Scaling x y Basic Transformations
3x3 Matrix Representations We can combine the multiplicative and translational terms for 2D transformations into a single matrix representation by expanding the 2x2 matrix representations to 3x3 matrices. This allows us to express all transformation equations as matrix multiplications.
Homogeneous Coordinates We represent each Cartesian coordinate position (x,y) with the homogeneous coordinate triple where
Homogeneous Coordinates(cont.) Thus, a general homogeneous coordinate representation can also be written as For 2D transformations we choose h=1. Each 2D position is represented with homogeneous coordinates
Translation in homogeneous coordinates
Rotation in homogeneous coordinates
Scaling in homogeneous coordinates
Composite Transformations:Translation If two successive translation are applied to a point P, then the final transformed location P' is calculated as
Composite Transformations:Rotation
Composite Transformations:Scalings
General Pivot Point Rotation Steps: -Translate the object so that the pivot point is moved to the coordinate origin. -Rotate the object about the origin. -Translate the object so that the pivot point is returned to its original position.
General Pivot Point Rotation(Cont.)
General Fixed Point Scaling Steps: -Translate the object so that the fixed point coincides with the coordinate origin. -Scale the object about the origin. -Translate the object so that the pivot point is returned to its original position.
General Fixed Point Scaling (x r, y r )
General Fixed Point Scaling
Concatenation Properties Matrix multiplication is associative Transformation product is not commutative
OTHER TRANSFORMATIONS Reflection About x-axis About y-axis x y
OTHER TRANSFORMATIONS x y Reflection about the origin
OTHER TRANSFORMATIONS Reflection about the line y=x. x y y = x 2 3
OTHER TRANSFORMATIONS Shear x-direction shear xx yy
TRANSFORMATION BETWEEN COORDINATE SYSTEMS Individual objects may be defined in their local cartesian reference system. The local coordinates must be transformed to position the objects within the scene coordinate system.
TRANSFORMATION BETWEEN COORDINATE SYSTEMS(Cont.) Steps for coordinate transformation -Translate so that the origin (x 0, y 0 ) of the x′-y′ system is moved to the origin of the x-y system. -Rotate the x′ axis on to the axis x.
TRANSFORMATION BETWEEN COORDINATE SYSTEMS(Cont.) y x x′ y′ θ x0x0 y0y0 0
TRANSFORMATION BETWEEN COORDINATE SYSTEMS(Cont.) y x x′ x0x0 y0y0 0 y′ θ
TRANSFORMATION BETWEEN COORDINATE SYSTEMS(Cont.) y x x′ x0x0 y0y0 0 y′
TRANSFORMATION BETWEEN COORDINATE SYSTEMS(Cont.)
An alternative method: - Specify a vector V that indicates the direction for the positive y′ axis. Let - Obtain the unit vector u=(u x,u y ) along the x′ axis by rotating v 90 0 clockwise.
TRANSFORMATION BETWEEN COORDINATE SYSTEMS(Cont.) - Elements of any rotation matrix can be expressed as elements of orhogonal unit vectors. That is, the rotation matrix can be written as
TRANSFORMATION BETWEEN COORDINATE SYSTEMS(Cont.) y x x′ y′ x0x0 y0y0 0 V
Three Dimensional Geometric Transformations
P=(x,y,z) x 3D Translation P′=(x′,y′,z′) y z
3D Translation
3D Rotation(z-axis) z-axis rotation P=(x,y,z) x y z
3D Rotation(z-axis)
x-axis rotation P=(x,y,z) x y z 3D Rotation(x-axis)
y-axis rotation P=(x,y,z) x y z 3D Rotation(y-axis)
General 3D Rotation Rotation about an axis that is parallel to x-axes. -Translate object so that the rotation axis coincides with the parallel coordinate axis. -Perform specified rotation about the axis. -Translate the object so that the rotation axis is moved back to its original position.
Rotation about an axis that is parallel to x-axes. Rotation axis x y z
General 3D Rotation Rotation about an axis that is not parallel to one of the coordinate axes. -Translate object so that the rotation axis passes through the coordinate origin. -Rotate object so that the axis of rotation coincides with one of the coordinate axes. -Perform the specified rotation about that coordinate axis -Apply inverse rotations to bring the rotation axis back to its original orientation. -Apply the inverse translation to brig the rotation axis back to its original position.
Rotation about an axis that is not parallel to one of the coordinate axes. Rotation axis x y z P2P2 P1P1 Initial Position
Rotation about an axis that is not parallel to one of the coordinate axes. x y z P2P2 P1P1 Translate P 1 to the origin
Rotation about an axis that is not parallel to one of the coordinate axes. x y z P2P2 P1P1 Rotate P 2 onto the z-axis and rotate the object around it.
Rotation about an axis that is not parallel to one of the coordinate axes. x y z P2P2 P1P1 Rotate the axis to the original orientation
Rotation about an axis that is not parallel to one of the coordinate axes. x y z P2P2 P1P1 Translate the rotation axis to the original position
Rotation about an axis that is not parallel to one of the coordinate axes. An axis vector is defined by two points as A unit vector is defined as
Rotation about an axis that is not parallel to one of the coordinate axes. The first step is to set up the translation matrix
Rotation about an axis that is not parallel to one of the coordinate axes. The next step is to put the rotation axis on the z-axis. x y z u
Rotation about an axis that is not parallel to one of the coordinate axes. First, we rotate about the x-axis to transform u into the x-z plane. x y z u α
Rotation about an axis that is not parallel to one of the coordinate axes. First, we rotate about the x-axis to transform u into the x-z plane. x y z u α u′u′ U z =(0,0,1) α
Rotation about an axis that is not parallel to one of the coordinate axes. We can define the sine of α from the cross product of u and u′.
Rotation about an axis that is not parallel to one of the coordinate axes. The rotation matrix is
Rotation about an axis that is not parallel to one of the coordinate axes. x y z u β
Rotation about an axis that is not parallel to one of the coordinate x-axes.