Graphics CSCI 343 Fall 2021 Lecture 12 Shear

  • Slides: 12
Download presentation
Graphics CSCI 343, Fall 2021 Lecture 12 Shear, General Rotations 1

Graphics CSCI 343, Fall 2021 Lecture 12 Shear, General Rotations 1

Trigonometry review r q x y 2

Trigonometry review r q x y 2

Rotation about a fixed point Suppose you want to rotate an object about a

Rotation about a fixed point Suppose you want to rotate an object about a fixed point, pf = (xf, yf, zf), about an axis parallel to the Z axis. y pf x z 1. Translate object so that pf is at the origin. 2. Rotate object about the Z axis 3. Translate object back to pf 3

Calculating the Rotation matrix 4

Calculating the Rotation matrix 4

General Rotation Can generate any rotation with a combination of Rx. Ry. Rz =

General Rotation Can generate any rotation with a combination of Rx. Ry. Rz = R. Calculating the angles can be tricky. Rotation about an arbitrary axis through the origin: 1. Use rotations to align the axis with the Z axis. 2. Rotate about the Z axis 3. Undo the rotations from (1). 5

Defining the Rotation Axis 1. Define rotation axis as a vector of length 1

Defining the Rotation Axis 1. Define rotation axis as a vector of length 1 (a unit vector) with x, y and z components: ax, ay, az where az ay ax v 6

Calculating qx y az ay d q v x 1. Project vector v to

Calculating qx y az ay d q v x 1. Project vector v to the y-z plane. (Draw line from tip of v perpendicular to y-z plane). 2. qx is the angle of this projection from the z axis. z where 7

Rotating about X axis 8

Rotating about X axis 8

Calculating qy When rotating about the X axis, the x component stays the same,

Calculating qy When rotating about the X axis, the x component stays the same, but the y and z components change. y r z ax qy 1 x cosqy = d sinqy = ax Note: The rotation is clockwise, so the angle will be negative. 9

The Rotation Matrix for Ry 10

The Rotation Matrix for Ry 10

The full rotation Rotation about an arbitrary axis: Rotation about a fixed point, pf,

The full rotation Rotation about an arbitrary axis: Rotation about a fixed point, pf, parallel to an arbitrary axis: 11

Shear y (x, y) y (x', y') q x Equations: x' = x+ycotq y'

Shear y (x, y) y (x', y') q x Equations: x' = x+ycotq y' = y z' = z x Matrix: 12