How to use a 4x4 Matrix to translate a point in 3D space

In summary, In personal study, you construct a matrix representing the current state of your point (location and rotation), and then use a matrix to transform the point to the desired state. You use a rotation matrix to achieve translation and rotation.
  • #1
STENDEC
21
0
Hello, apologies in advance if my questions seem rather ignorant. I'm trying my best (and struggling) to understand the topic, but my background in math is weak, and i need the math for artistic purposes.

I want to iteratively move and rotate a point in 3D space (move, rotate, move, rotate...) and from what I understand multiplication of 4x4 matrices lends itself to the task. The point has a direction it's pointing in (necessary for such motion); I take it that makes it a vector?

Let's say the point's position (Cartesian coordinates) is [itex](2, 1.5, 3)[/itex]
And the direction it points in is [itex](1, 0, 0)[/itex]
From what I understand, I first create a matrix that represents the current state:

[itex]Matrix1=
\begin{bmatrix}
0 & 0 & 0 & 2 \\
0 & 0 & 0 & 1.5 \\
0 & 0 & 0 & 3 \\
0 & 0 & 0 & 1 \end{bmatrix}[/itex]
Is this matrix ok (maybe missing 1's in the first 3 columns?) or have I fundamentally misunderstood something?Next I have to create a matrix that transforms the location and rotation of the point/vector. Through my online searches I found this:

[itex]Matrix2=
\begin{bmatrix}
tx^2+c & txy-sz & txz+sy & X_{1} \\
txy+sz & ty^2+c & tyz-sx & Y_{1} \\
txz-sy & tyz-sx & tz^2+c & Z_{1} \\
0 & 0 & 0 & 1 \end{bmatrix}[/itex]
Where:
[itex]X_{1}, Y_{1}, Z_{1}[/itex] is the desired translation in Cartesian coordinates, e.g. [itex]0, 0, 3.75[/itex] to move 3.75 units along the system's z axis.
[itex]x, y, z[/itex] are the unit vector ([itex]1, 0, 0[/itex] in my case)
[itex]c = cosθ[/itex]
[itex]s = sinθ[/itex]
[itex]t = 1-cosθ[/itex]

Is the angle [itex]θ[/itex] in degrees or radians, can you tell from looking at its usage?

1. Once I have constructed Matrix2, do I multiply it by Matrix1 to derive a Matrix3 which contains the new position/direction of my point?

2. How would i go about retrieving the new Cartesian coordinates (position and rotation) from Matrix3?

3a. If Matrix2 contains my desired transformation, can i repeatedly multiply it with the result of a prior multiplication (M3'=M3xM2, M3=M3', M3'=M3xM2...) to achieve my original goal of iterative translation (most likely resulting in a circle or helix)?

3b. If i had to feed Matrix2 a unit vector, wouldn't what comes in from Matrix3' during the next iteration be unsuitable?Again, sorry if i expose gaping holes in my comprehension. I hope my intentions make some sense.

Thanks!
 
Last edited:
Physics news on Phys.org
  • #2
This is an example of "projective geometry" in which we think of the set of all lines through the orgin in n-dimensional space as points in n-1 dimensional space.

Specifically, a line through the origin can be written [itex]x_1= a_1t[/itex], [itex]x_2= a_2t[/itex], ..., [itex]x_n= a_nt[/itex] which we could represent as the vector equation [itex]<x_1, x_2, ..., x_n>= <a_1, a_2, ..., a_n>t[/itex]. If we take s= zt as parameter instead of t, t= s/z so that becomes [itex]<x_1, x_2, ..., x_n>= <a_1/a_n, a_2/a_n, ..., 1>z[/itex] which we can interpret as the point [itex](a_1/a_n, a_2/a_n, ..., a_{n-1}/a_n, 1)[/itex], in Rn-1, ignoring that last "1" but with the understanding that if any operation changes that last component, we immediately divide through by it to alway get 1.
In that way, we can represent a point (a, b, c) as the column matrix [itex]\begin{bmatrix}a \\ b\\ c\\ 1\end{bmatrix}[/itex].

Now, notice that the matrix multiplication
[tex]\begin{bmatrix}1 & 0 & 0 & dx \\ 0 & 1 & 0 & dy \\ 0 & 0 & 1 & dz\\ 0 & 0 & 0 & 1\end{bmatrix}\begin{bmatrix}a \\ b \\ c \\ 1\end{bmatrix}= \begin{bmatrix}a+ dx \\ b+ dy\\ c+ dz \\ 1\end{bmatrix}[/tex]
gives the column matrix corresponding to the point (a+ dx, b+ dy, c+ dz).

If we were to replace the first three rows and columns by a "rotation matrix" we get both rotation and translation, giving all rigid motions in three dimensions, in a single matrix.
 
Last edited by a moderator:
  • #3
Thank you HallsOfIvy! This has helped clarify some things for me and i got the first results in the right direction. It seems that among other things, i was confused about column vs row-major notation as well.

I saw that the homework & coursework section of this forum is also for "personal study" and thus probably better suited if i want extended assistance. I will prepare a new post there building on what i learned.
 

What is a 4x4 matrix?

A 4x4 matrix is a mathematical representation of a set of numbers arranged in a rectangular grid with four rows and four columns. It is commonly used in computer graphics and linear algebra to perform transformations on points in three-dimensional space.

How is a 4x4 matrix used to translate a point in 3D space?

A 4x4 matrix can be used to represent translation in three-dimensional space by using the last column to store the X, Y, and Z values of the translation vector. When multiplied by a point in homogeneous coordinates, the translation vector is added to the point's coordinates, resulting in a translated point.

What is the difference between a 4x4 matrix and a 3x3 matrix?

A 4x4 matrix contains four rows and four columns, while a 3x3 matrix contains three rows and three columns. The extra row and column in a 4x4 matrix are used to represent translation, rotation, and scaling in three-dimensional space.

What are the three types of transformations that can be performed with a 4x4 matrix?

A 4x4 matrix can perform translation, rotation, and scaling in three-dimensional space. Translation is represented by the last column, rotation is represented by the first three columns, and scaling is represented by the main diagonal of the matrix.

Can a 4x4 matrix be used to perform multiple transformations?

Yes, a 4x4 matrix can be used to perform multiple transformations by multiplying it with the point's coordinates in a specific order. For example, to perform translation followed by rotation, the translation matrix would be multiplied by the rotation matrix and then by the point's coordinates.

Similar threads

  • Calculus and Beyond Homework Help
Replies
4
Views
823
Replies
3
Views
2K
Replies
5
Views
1K
Replies
5
Views
2K
Replies
2
Views
2K
  • Advanced Physics Homework Help
Replies
3
Views
1K
  • Differential Geometry
Replies
4
Views
3K
  • Advanced Physics Homework Help
Replies
10
Views
3K
  • Linear and Abstract Algebra
Replies
2
Views
2K
  • Linear and Abstract Algebra
Replies
5
Views
2K
Back
Top