Matrix Multiplication to translate object with given vertices

Click For Summary

Discussion Overview

The discussion revolves around the process of translating an object represented by vertices using matrix multiplication. Participants explore the application of translation matrices in both 2D and 3D contexts, particularly in relation to computer graphics.

Discussion Character

  • Technical explanation
  • Mathematical reasoning
  • Exploratory

Main Points Raised

  • Some participants suggest starting with the vertices as a matrix and inquire about the correct format for this matrix.
  • One participant proposes using a 4x4 matrix for translation in 3D, explaining that the translation coefficients correspond to a vector for translation.
  • Another participant discusses the use of projective coordinates, indicating that a translation can be represented with a specific matrix form in 2D.
  • There is a suggestion that a translation matrix can be applied to all points simultaneously, using a single matrix multiplication with the vertices represented in a specific format.
  • One participant expresses a desire for a quicker method to translate all coordinates, questioning whether a larger matrix is necessary.
  • Another participant confirms that the same translation matrix can be used for all points, demonstrating this with a matrix multiplication example.

Areas of Agreement / Disagreement

Participants generally agree on the utility of using translation matrices for the task, but there are differing views on the dimensionality of the matrices and the best approach to apply translations to multiple points simultaneously.

Contextual Notes

Some participants note the complexity of using 3D matrices versus 2D matrices and the implications of projective coordinates, indicating that the discussion may depend on specific definitions and assumptions about the dimensionality of the problem.

Phys121VIU
Messages
17
Reaction score
0
This was a question for a test of mine. I am unsure how to translate the object from the left image(Fig.1) to the right (Fig.2). I am to use matrix multiplication..

Do i start with the vertices in Fig.1 as a matrix, as in |0 -1 -2 0 -2 -1 |
...............|0 0 0 2 2 3 |

(I apologize, i don't know how to make large square brackets..)
 

Attachments

  • Midterm4,Q6.jpg
    Midterm4,Q6.jpg
    33.6 KB · Views: 717
Physics news on Phys.org
Phys121VIU said:
This was a question for a test of mine. I am unsure how to translate the object from the left image(Fig.1) to the right (Fig.2). I am to use matrix multiplication..

Do i start with the vertices in Fig.1 as a matrix, as in |0 -1 -2 0 -2 -1 |
...............|0 0 0 2 2 3 |

(I apologize, i don't know how to make large square brackets..)

Hey Phys121VIU.

In terms of translation matrices used in computer graphics, it's easier to use a 4x4 matrix with a 'w' co-ordinate to perform the transformation and then basically project a 4-vector to a 3-vector.

In other words your matrix will look like this:

[a b c d]
[e f g h]
[i j k l]
[m n o p]

where [d h l p]^T is going to be the translation co-effecients corresponding to the vector <x,y,z,w> for translation. If you make the upper LHS 3x3 matrix an identity and your [d h l p] matrix corresond to <Tx,Ty,Tz,0> then when you apply this matrix to a point X you will get Mx = x + T where T is the translation vector above.

Although the output vector is four-dimensional, your w component will be 0 and will reduce to a normal 3d vector if you project it onto the 3-D space where w = 0.

In terms of having a general matrix to do this for all the points, you can not have a 3D matrix that can be applied to all points to give you that result if you want the matrix itself to be a constant as opposed to something that varies with points.

If you want to do it with 3D matrices, then you will have to create a matrix that is a function of the points themselves and this will require extra work.

My guess is that they probably don't want something complicated, so a 4x4 matrix will do the trick along with a projection to the constraint w = 0.
 
Phys121VIU said:
This was a question for a test of mine. I am unsure how to translate the object from the left image(Fig.1) to the right (Fig.2). I am to use matrix multiplication..

Do i start with the vertices in Fig.1 as a matrix, as in |0 -1 -2 0 -2 -1 |
...............|0 0 0 2 2 3 |

(I apologize, i don't know how to make large square brackets..)

[tex]\begin{bmatrix}0 & -1 & -2 & 0 & -2 & -1 \\ 0 & 0 & 0 & 2 & 2 & 3\end{bmatrix}[/tex]
(Click on that to see the code.)

Those are the coordinates of 6 points in two-dimensions. A 2 by 2 matrix, of the form
[tex]\begin{bmatrix}cos(\theta) & -sin(\theta) \\ sin(\theta) & cos(\theta)\end{bmatrix}[/tex]
gives a rotation around the origin through angle [itex]\theta[/itex]. A translation would, normally, be a vector to be added.

But you can, as chiro says, use "projective" coordinates, with point (x, y) represented by (x, y, 1) with the understanding that if some operation causes the third coordinate to change, we divide each coordinate by that to get back to 1- the point (ax, ay, a) is the same point as (x, y, 1). However, I think chiro is giving the case of projective coordinates in 3 dimensions so the matrix has 3+ 1= 4 rows and columns. If you are working in two dimensions so your matrix should have 2+ 1= 3 rows and columns.

Doing that, a translation, adding a to the x-coordinate and b to the y coordinate, is given by
[tex]\begin{bmatrix}1 & 0 & a \\ 0 & 1 & b \\ 0 & 0 & 1\end{bmatrix}\begin{bmatrix}x \\ y \\ 1\end{bmatrix}= \begin{bmatrix}x+ a\\ y+ b\\ 1\end{bmatrix}[/tex]
 
Last edited by a moderator:
\begin{bmatrix}0 & -1 & -2 & 0 & -2 & -1 \\ 0 & 0 & 0 & 2 & 2 & 3\end{bmatrix}

(Click on that to see the code.)

Thanks for this!


Ok i am beginning to understand this question..To translate, say the top point of the object,
\begin{bmatrix}-1 \\ 3\end{bmatrix} to the new coordinate \begin{bmatrix}2 \\ 5\end{bmatrix} i would use
\begin{bmatrix}1 & 0 & 3 \\ 0 & 1 & 2 \\ 0 & 0 & 1\end{bmatrix}\begin{bmatrix}-1 \\ 3 \\ 1\end{bmatrix}= \begin{bmatrix}(-1)+3\\ 3+2\\ 1\end{bmatrix}

That is awesome! Thanks so much

Is there a quicker way to translate all of the coordinates? like in the 2x6 matrix shown above?

It seems if I go about the same method, I would need a 6x6 matrix..?
 
No, you can use the same "translation" matrix, just do it as a single matrix multiplication using all of the points as a single matrix:
[tex]\begin{bmatrix}1 & 0 & 3 \\ 0 & 1 & 2 \\ 0 & 0 & 1\end{bmatrix}\begin{bmatrix}0 & -1 & -2 & 0 & -2 & -1 \\ 0 & 0 & 0 & 2 & 2 & 3 \\ 1 & 1 & 1 & 1 & 1 & 1\end{bmatrix}=\begin{bmatrix}3 & 2 & 1 & 3 & 1 & 2 \\ 2 & 2 & 2 & 4 & 4 & 5 \\ 1 & 1 & 1 & 1 & 1 & 1 \end{bmatrix}[/tex]
 
Last edited by a moderator:

Similar threads

  • · Replies 9 ·
Replies
9
Views
3K
  • · Replies 14 ·
Replies
14
Views
4K
  • · Replies 10 ·
Replies
10
Views
3K
  • · Replies 33 ·
2
Replies
33
Views
3K
  • · Replies 7 ·
Replies
7
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 15 ·
Replies
15
Views
2K
  • · Replies 7 ·
Replies
7
Views
4K