0

I try to understand math for 3D games.

If I want to translate a point, I may do it in two ways:
1. Using vector summation.
2. Using matrix multiplication.

For example: Initial vector $p =(1,2,3)$.
has to be translated by $t=(4,5,-6)$.
$p + a = p2 => (1+4, 2+5, 3-6) = (5,7,-3)$.

If I want to complete "undo", I may $p3 = p2 + (-a)$ ,
The math is simple.

But in books people often use matrix multiplication
from wiki

For me it seems like doing much more computation.

I wonder, why do people use 4x4 matrix to do the same thing?

Dima
  • 3
  • Can you provide an example how a $4\times 4$ matrix does the same thing and where that is used? I see no reason why that would be useful... – 5xum Aug 04 '14 at 07:34

2 Answers2

0

As far as I know, calculating $T_vp$ in the way you described is not computationaly efficient. If you just want to calculate $v+p$, then it is simpler to calculate it by summing all of the coordinate scalars of $v$ and $p$.

The matrix $T_v$ shows only that the nonlinear mapping $x\mapsto x+v$ (which is not a linear mapping for $v\neq 0$ can be understood as a linear mapping, albeit in a higher dimensional space.

5xum
  • 123,496
  • 6
  • 128
  • 204
0

The basic idea is to describe all affine transformations (scaling, translation, rotation) by more or less the same operation, namely multiplication by a $4\times 4$-matrix. To achive this, we embed, as you write $\mathbb R^3$ into $\mathbb RP^3$, or the affine part of it, i. e. $\mathbb R^3 \times \{1\} \subseteq \mathbb R^4$. A scaling, or rotation, respresented in $\mathbb R^3$ by a matrix multiplication, $x \mapsto Ax$ for some $A \in {\rm Mat}_3(\mathbb R)$, is now represented by $$ \begin{pmatrix} A & 0 \\ 0 & 1 \end{pmatrix} \cdot \begin{pmatrix} x \\ 1\end{pmatrix} = \begin{pmatrix} Ax \\ 1 \end{pmatrix} $$ any affine map $x \mapsto Ax + b$ can now be represented as above, $$ \begin{pmatrix} A & b \\ 0 & 1 \end{pmatrix} \begin{pmatrix} x \\ 1 \end{pmatrix} = \begin{pmatrix} Ax + b \\ 1 \end{pmatrix} $$ A key point is, that the composition of opertions is now just matrix multiplication, if you differentiate between linear operations and translation, computing compositions is harder.

martini
  • 84,101
  • Probably matrix multiplication may be a choice when it used with other operations such us rotation, scaling. Intermediate matrix ($M1 = MrotMscalMtransl$) maybe computed once and after that used for moving all points: $p2 = p1M1$, instead of $p2 = p1(Mrot*Mscal) + vTransl$ – Dima Aug 04 '14 at 08:27
  • Exactly.${}{}{}$ – martini Aug 04 '14 at 08:31