Shape Analysis #1: Introduction

7 months ago
geometrylearningcomputer-graphics

Different Type of Geometries

Euclidean GeometryShape are invariant by translations, rotations & uniform scaling
Affine GeometryEuclidean Transformations + shearing (non-uniform scaling)
Projective GeometryAffine Transformations + projections

We always assume that all shapes lie in Euclidean space R2\mathbb{R}^2 or R3\mathbb{R}^3.

A transformation is a map from the space to space itself T:En→EnT: E^n \to E^n

Some basic transformations are:

  • rotation
  • translation

If TT satisfy d(x,y)=d(T(x),T(y))∀x,y∈End(x, y) = d(T(x), T(y)) \forall x, y\in E^n, then TT is called an isometry.

  • An isometry that map origin to itself is a rotation or reflection.
  • An isometry is always composed of a rotation/reflection and a translation
  • A rotation RR preserves inner product. i.e <R(x),R(y)>=<x,y>∀x,y<R(x), R(y)> = <x,y> \forall x, y
  • A rotation RR is indeed just a matrix multiplication operator.

Note that:

  • RR us orthogonal (RT=R−1R^T = R^{-1})
  • In 2D, the rotation "rotates" a vector around a point.
  • In 3D, the rotation is composed of:
    • An axis of rotation: eigenvector of RR with eigenvalue 11.
    • A rotation angle θ\theta.

E.g:

Rz,θ:(xyz)↦(xcos⁡(θ)−ysin⁡(θ)xsin⁡(θ)+ycos⁡(θ)z)\mathcal{R}_{z,\theta}: \begin{pmatrix}x\\ y\\ z \end{pmatrix} \mapsto \begin{pmatrix}x\cos(\theta)-y\sin(\theta)\\ x\sin(\theta)+y\cos(\theta)\\ z \end{pmatrix}

Rotation around an arbitrary axis

  • To rotate around an axis l=(u,v,w)l=(u,v,w) by angle θ\theta, we use Rodrigues' rotation formula:
R(u,v,w),θ=I+sin⁡(θ)U+(1−cos⁡(θ))U2R_{(u,v,w),\theta} = I + \sin(\theta)U + (1-\cos(\theta))U^2 where U=(0−wvw0−u−vu0)\text{where } U = \begin{pmatrix} 0 & -w & v \\ w & 0 & -u \\ -v & u & 0 \end{pmatrix}

Rotation - Other representations

Euler angles or Tait–Bryan angles:

Represent an arbitrary rotations by a combination of three rotation around the principle axes:

R=Rx,αRy,βRz,γ=(1000cos⁡(α)−sin⁡(α)0sin⁡(α)cos⁡(α))(cos⁡(β)0sin⁡(β)010−sin⁡(β)0cos⁡(β))(cos⁡(γ)−sin⁡(γ)0sin⁡(γ)cos⁡(γ)0001)\begin{align*} R &= R_{x,\alpha}R_{y,\beta}R_{z,\gamma} &= \begin{pmatrix} 1 & 0 & 0 \\ 0 & \cos(\alpha) & -\sin(\alpha) \\ 0 & \sin(\alpha) & \cos(\alpha) \end{pmatrix} \begin{pmatrix} \cos(\beta) & 0 & \sin(\beta) \\ 0 & 1 & 0 \\ -\sin(\beta) & 0 & \cos(\beta) \end{pmatrix} \begin{pmatrix} \cos(\gamma) & -\sin(\gamma) & 0 \\ \sin(\gamma) & \cos(\gamma) & 0 \\ 0 & 0 & 1 \end{pmatrix} \end{align*}

The idea here is:

  • Euler angles lose degree of freedom at certain value (e.g β=π2\beta = \frac{\pi}{2})
  • Cannot represent all "continuous" path of rotations!

This all brings us back to the notation of quaternion:

  • A vector with 44 components, with 3 imaginary ones:
q=a+bi+cj+dk,i2=j2=k2=ijk=−1q = a + bi + cj + dk, \quad\quad\quad i^2 = j^2 = k^2 = ijk = -1
  • Adding quaternions works simply elementwise
  • Multiplication is defined using the rules i2=j2=k2=ijk=−1i^2=j^2=k^2=ijk=-1

Rotation - Benefit of quaternion

  • every rotation is represented by a unit 4D quaternion (or its opposite)
  • this provides a double cover of the space of rotations
    • isomorphic to SU(2), closely related to spinors in physics
    • no singularity to worry about
  • operations on rotations often simple (interpolation, composition, ...)

Other transformation

Scaling

(xyz)↦(sxsysz)Ss=(s000s000s)(xyz)↦(sxxsyyszz)Ssx,sy,sz=(sx000sy000sz)\begin{alignat*}{3} &\begin{pmatrix} x\\ y\\ z \end{pmatrix} \mapsto \begin{pmatrix} sx\\ sy\\ sz \end{pmatrix} &&\quad \mathcal{S}_s &&= \begin{pmatrix} s & 0 & 0\\ 0 & s & 0\\ 0 & 0 & s \end{pmatrix}\\ &\begin{pmatrix} x\\ y\\ z \end{pmatrix} \mapsto \begin{pmatrix} s_xx\\ s_yy\\ s_zz \end{pmatrix} &&\quad \mathcal{S}_{s_x,s_y,s_z} &&= \begin{pmatrix} s_x & 0 & 0\\ 0 & s_y & 0\\ 0 & 0 & s_z \end{pmatrix} \end{alignat*}

Translation

Ttx,ty,tz:(xyz)↦(x+txy+tyz+tz)\mathcal{T}_{t_x,t_y,t_z}: \begin{pmatrix} x\\ y\\ z \end{pmatrix} \mapsto \begin{pmatrix} x+t_x\\ y+t_y\\ z+t_z \end{pmatrix}

Affine Homogeneous Coordinates

Now we represent 3D coordinate (x,y,z)(x,y,z) by a a vector with another dimension:

(xyz)→(xyz1)\begin{pmatrix} x\\ y\\ z \end{pmatrix} \to \begin{pmatrix} x\\ y\\ z\\ 1 \end{pmatrix}

This is to make translation to be actually just a matrix multiplication too:

Ttx,ty,tz(x,y,z)=(100tx010ty001tz0001)(xyz1)=(x+txy+tyz+tz)\mathcal{T}_{t_x,t_y,t_z}(x, y, z) = \begin{pmatrix} 1 & 0 & 0 & t_x\\ 0 & 1 & 0 & t_y\\ 0 & 0 & 1 & t_z\\ 0 & 0 & 0 & 1 \end{pmatrix} \begin{pmatrix} x\\ y\\ z\\ 1 \end{pmatrix} = \begin{pmatrix} x+t_x\\ y+t_y\\ z+t_z \end{pmatrix}

Note: Any affine transformation in 3D is a linear transformation in 4D

Projections

To project on the screen (actually just a surface) z=0z=0:

  • Orthogonal projection:
(xyz)↦(xy0)PO=(1000010000000001)\begin{pmatrix}x\\ y\\ z\end{pmatrix} \mapsto \begin{pmatrix}x\\ y\\ 0\end{pmatrix}\quad \mathcal{P}_O = \begin{pmatrix} 1 & 0 & 0 & 0\\ 0 & 1 & 0 & 0\\ 0 & 0 & 0 & 0\\ 0 & 0 & 0 & 1 \end{pmatrix}
  • Perspective projection:
(xyz)↦(x/zy/z0)PO=(???)\begin{pmatrix}x\\ y\\ z\end{pmatrix} \mapsto \begin{pmatrix}x/z\\ y/z\\ 0\end{pmatrix}\quad \mathcal{P}_O = \begin{pmatrix} ??? \end{pmatrix}

Actually, we can still make use of the homogenous coordinates:

PP(x,y,z)=(1000010000000010)(xyz1)=(xy0z)≡(x/zy/z0)\mathcal{P}_P(x,y,z) = \begin{pmatrix} 1 & 0 & 0 & 0\\ 0 & 1 & 0 & 0\\ 0 & 0 & 0 & 0\\ 0 & 0 & 1 & 0 \end{pmatrix} \begin{pmatrix} x\\ y\\ z\\ 1 \end{pmatrix} = \begin{pmatrix} x\\ y\\ 0\\ z \end{pmatrix} \equiv \begin{pmatrix} x/z\\ y/z\\ 0 \end{pmatrix}

We simply used: (xyzw)≡(x/wy/wz/w)\begin{pmatrix}x\\ y\\ z\\ w\end{pmatrix}\equiv\begin{pmatrix}x/w\\ y/w\\ z/w\end{pmatrix}

Now we know where the name homogenous comes from.

Conclusion

Geometric modeling is about shape representation & manipulation

  • In Euclidean world, isometric transformations are translations/rotations
  • Representation of rotations: rotation matrices, quaternions…
  • All conveniently represented w/ matrices; composition = matrix multiplication.
  • Homogeneous coordinates "linearize" most useful transformations

Comments (0)

No comments yet. Be the first to share your thoughts!