Prev: W11, Next: W13

# Overview

📗 Readings: CG Chapter 6.
📗 Wikipedia page: Link

# 3D Transformations

📗 Articulated motions are often used in games and is usually achieved through object hierarchy (as opposed to computing position of each part independently). One example is the model for robotic arms, where the translation, rotation, and scaling of one joint is defined in the coordinate system defined by the previous joint.
➭ Translation: in 2D \(T = \begin{bmatrix} 1 & 0 & x \\ 0 & 1 & y \\ 0 & 0 & 1 \end{bmatrix}\) and in 3D \(T = \begin{bmatrix} 1 & 0 & 0 & x \\ 0 & 1 & 0 & y \\ 0 & 0 & 1 & z \\ 0 & 0 & 0 & 1 \end{bmatrix}\), pre-multiplying a point in homogeneous coordinates (i.e. add 1 to the position vector) by \(T\) translates it by \(\begin{bmatrix} x \\ y \end{bmatrix}\) in 2D and \(\begin{bmatrix} x \\ y \\ z \end{bmatrix}\) in 3D.
➭ Rotation: in 2D a counterclockwise rotation of theta can be done by pre-multiplying a point by \(R = \begin{bmatrix} \cos \theta & - \sin \theta & 0 \\ \sin \theta & \cos \theta & 0 \\ 0 & 0 & 1 \end{bmatrix}\), and in 3D, any rotation can be represented as a composition of rotations around x, y, z axes (roll, pitch, yaw) which can be done by pre-multiplying a point by \(R = \begin{bmatrix} \cos \alpha & - \sin \alpha & 0 & 0 \\ \sin \alpha & \cos \alpha & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \end{bmatrix} \begin{bmatrix} \cos \beta & 0 & \sin \beta & 0 \\ 0 & 1 & 0 & 0 \\ - \sin \beta & 0 & \cos \beta & 0 \\ 0 & 0 & 0 & 0 \end{bmatrix} 1 \begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & \cos \gamma & - \sin \gamma & 0 \\ 0 & \sin \gamma & \cos \gamma & 0 \\ 0 & 0 & 0 & 1 \end{bmatrix}\).
➭ Scaling: in 2D \(S = \begin{bmatrix} x & 0 & 0 \\ 0 & y & 0 \\ 0 & 0 & 1 \end{bmatrix}\) and in 3D \(T = \begin{bmatrix} x & 0 & 0 & 0 \\ 0 & y & 0 & 0 \\ 0 & 0 & z & 0 \\ 0 & 0 & 0 & 1 \end{bmatrix}\), pre-multiplying a point in homogeneous coordinates scales it by \(\begin{bmatrix} x \\ y \end{bmatrix}\) in 2D and \(\begin{bmatrix} x \\ y \\ z \end{bmatrix}\) in 3D.

📗 Figuring out how to move can be done with inverse kinematics or reinforcement learning (planning).






Last Updated: May 07, 2024 at 12:22 AM