Matrix Multiplication to translate object with given vertices

In summary, matrix multiplication is a mathematical operation commonly used in fields such as physics, engineering, and computer graphics to produce a new matrix by multiplying two matrices. In computer graphics, it is specifically used to transform the coordinates of an object by multiplying its vertices with a translation matrix. This matrix is a 3x3 matrix composed of values representing the amount of translation in the x, y, and z direction. During matrix multiplication, the object's vertices are multiplied by the translation matrix, resulting in new coordinates that determine the object's new position after translation. Additionally, matrix multiplication can also be used for other transformations such as rotation, scaling, and shearing by using specific transformation matrices.
  • #1
Phys121VIU
17
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: 647
Physics news on Phys.org
  • #2
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.
 
  • #3
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:
  • #4
\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..?
 
  • #5
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:

What is matrix multiplication?

Matrix multiplication is a mathematical operation that involves multiplying two matrices to produce a new matrix. This operation is commonly used in various fields such as physics, engineering, and computer graphics.

How is matrix multiplication used to translate objects?

In computer graphics, matrix multiplication is used to transform the coordinates of an object. By multiplying the object's vertices by a translation matrix, the object can be translated in any direction.

What is a translation matrix?

A translation matrix is a 3x3 matrix that is used to transform the coordinates of an object. It is composed of values that represent the amount of translation in the x, y, and z direction.

What happens to the object's vertices during matrix multiplication?

During matrix multiplication, the object's vertices are multiplied by the translation matrix, resulting in new coordinates for each vertex. These new coordinates determine the new position of the object after the translation.

Can matrix multiplication be used for other transformations?

Yes, matrix multiplication can be used for various transformations such as rotation, scaling, and shearing. Each transformation requires a specific transformation matrix, which is multiplied by the object's vertices to achieve the desired transformation.

Similar threads

  • Linear and Abstract Algebra
Replies
10
Views
2K
  • Linear and Abstract Algebra
Replies
9
Views
1K
  • Linear and Abstract Algebra
Replies
1
Views
810
  • Linear and Abstract Algebra
Replies
5
Views
946
  • Linear and Abstract Algebra
Replies
8
Views
789
  • Linear and Abstract Algebra
Replies
2
Views
757
  • Linear and Abstract Algebra
Replies
3
Views
920
  • Linear and Abstract Algebra
Replies
7
Views
2K
  • Linear and Abstract Algebra
Replies
34
Views
2K
  • Linear and Abstract Algebra
Replies
8
Views
880
Back
Top