OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

visualize rotated point in rotation matrix

  • Thread starter Thread starter mystic.06
  • Start date Start date
M

mystic.06

Guest
I have a default 4x4 transformation matrix consist of 3x3 rotation matrix, 3x1 translation vector and 1x3 scaling vector:

Code:
matrix_default= [[1, 0, 0, 0],
                 [0, 1, 0, 0],
                 [0, 0, 1, 0],
                 [0, 0, 0, 1]]

I apply a translation in x-direction and visualize it using:

Code:
matrix_translated= [[1, 0, 0, 10],
                    [0, 1, 0, 0],
                    [0, 0, 1, 0],
                    [0, 0, 0, 1]]


fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
ax.set_xlabel('X-axis')
ax.set_ylabel('Y-axis')
ax.set_zlabel('Z-axis')

# Visualize translation
ax.scatter(matrix_default[0, 3], matrix_default[1, 3], matrix_default[2, 3], color='r', s=10**2)
ax.scatter(matrix_translated[0, 3], matrix_translated[1, 3], matrix_translated[2, 3], color='black', s=10**2)

plt.show()

point translated

I want to also visualize if I apply a rotation in any direction, so that it is visualized as cartesian coordinate system on the drawn point as e.g. lines with arrows:

applied rotation

EDIT: A 90° rotation applied on z-axis looks like in rotation matrix:

Code:
   matrix_rotated= [[-1, -2, 0, 0],
                    [2, -1, 0, 0],
                    [0, 0, 1, 0],
                    [0, 0, 0, 1]]

I want to represent this rotation using arrows/lines
<p>I have a default 4x4 transformation matrix consist of 3x3 rotation matrix, 3x1 translation vector and 1x3 scaling vector:</p>
<pre><code>matrix_default= [[1, 0, 0, 0],
[0, 1, 0, 0],
[0, 0, 1, 0],
[0, 0, 0, 1]]
</code></pre>
<p>I apply a translation in x-direction and visualize it using:</p>
<pre><code>matrix_translated= [[1, 0, 0, 10],
[0, 1, 0, 0],
[0, 0, 1, 0],
[0, 0, 0, 1]]


fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
ax.set_xlabel('X-axis')
ax.set_ylabel('Y-axis')
ax.set_zlabel('Z-axis')

# Visualize translation
ax.scatter(matrix_default[0, 3], matrix_default[1, 3], matrix_default[2, 3], color='r', s=10**2)
ax.scatter(matrix_translated[0, 3], matrix_translated[1, 3], matrix_translated[2, 3], color='black', s=10**2)

plt.show()
</code></pre>
<p><a href="https://i.sstatic.net/MYKg7opB.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/MYKg7opB.png" alt="point translated" /></a></p>
<p>I want to also visualize if I apply a rotation in any direction, so that it is visualized as cartesian coordinate system on the drawn point as e.g. lines with arrows:</p>
<p><a href="https://i.sstatic.net/lerwwL9F.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/lerwwL9F.png" alt="applied rotation" /></a></p>
<p>EDIT:
A 90° rotation applied on z-axis looks like in rotation matrix:</p>
<pre><code> matrix_rotated= [[-1, -2, 0, 0],
[2, -1, 0, 0],
[0, 0, 1, 0],
[0, 0, 0, 1]]
</code></pre>
<p>I want to represent this rotation using arrows/lines</p>
 

Latest posts

M
Replies
0
Views
1
Meliodas Dragon
M
Top