Skip to main content
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
edited title
Link
cvgmt
  • 91.7k
  • 6
  • 113
  • 194

How to Form Rigid Body Transformation Matrices?

Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
edited title
Link
user64494
  • 1
  • 4
  • 29
  • 60

How to formForm Rigid Body Transformation Matrices?

Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
added 409 characters in body
Source Link
Marvin
  • 614
  • 4
  • 11

We have two line segments specified by a pair of points $(b_1,t_1)$, and $(b_2,t_2)$. We want to find the transformation between the two line segments. Define a unit vector $z_1$ from $b_1$ and pointing towards $t_1$. Similarly, define $z_2$. Then, I want to find some translation vector and rotation matrix, such that any point in $z_2$ can be expressed in terms from $z_1$. I understand that the problem is slightly ill-posed because there can be multiple solutions.

Define points and get rotation matrices:

b1 = {1, 0, 1}; t1 = {1, 2, 1}; b2 = {0, 1, 0}; t2 = {1, 1, 0}; z1 = (t1 - b1)/Norm[(t1 - b1)]; z2 = (t2 - b2)/Norm[(t2 - b2)]; Rot1 = RotationMatrix[{{0, 0, 1}, z1}] Rot2 = RotationMatrix[{{0, 0, 1}, z2}] 

Get $4\times 4$ transformation matrices:

T1 = Join[MapThread[Append, {Rot1, b1}], {{0, 0, 0, 1}}] T2 = Join[MapThread[Append, {Rot2, b2}], {{0, 0, 0, 1}}] T21 = T2 . Inverse[T1] 
{r1, l1, r2, l2} = {0.1, Norm[b1 - t1], 0.1, Norm[b2 - t2]}; t21 = (T21 . {0, 0, 0, 1})[[1 ;; 3]]; 

The distances between the points don't hold. They should remain the same after transformation.

Norm[b2 - b1] Norm[t21] 

Position and orientation of line segments after transformation

Show[Graphics3D[{Cylinder[{{0, 0, 0}, {0, 0, l1}}, r1]}], Graphics3D[Cylinder[{t21, (T21 . {0, 0, l2, 1})[[1 ;; 3]]}, r2]], Boxed -> False] 

Position and orientation of line segments after transformation

Position and orientation of line segments before transformation

Show[Graphics3D[{Cylinder[{b1, t1}, r1]}], Graphics3D[Cylinder[{b2, t2}, r1]], Boxed -> False] 

Position and orientation of line segments before transformation

The two figures look different from each other. Also, distance between points are not maintained. Am I using RotationMatrix correctly? Also, I might be wrong about mathematical concept of transformation.

Edit(Clarification): Consider a coordinate system {1} such that $z_1$ (line segment 1) is aligned with the $z$-axis of the coordinate system {1} and origin at $b_1$. Similarly, let $z$-axis of coordinate system {2} align with $z_2$ (line segment 2) and origin at $b_2$. Then I want to express the second line segment in terms of the coordinate system {1} in the form of some translation and rotation.

We have two line segments specified by a pair of points $(b_1,t_1)$, and $(b_2,t_2)$. We want to find the transformation between the two line segments. Define a unit vector $z_1$ from $b_1$ and pointing towards $t_1$. Similarly, define $z_2$. Then, I want to find some translation vector and rotation matrix, such that any point in $z_2$ can be expressed in terms from $z_1$. I understand that the problem is slightly ill-posed because there can be multiple solutions.

Define points and get rotation matrices:

b1 = {1, 0, 1}; t1 = {1, 2, 1}; b2 = {0, 1, 0}; t2 = {1, 1, 0}; z1 = (t1 - b1)/Norm[(t1 - b1)]; z2 = (t2 - b2)/Norm[(t2 - b2)]; Rot1 = RotationMatrix[{{0, 0, 1}, z1}] Rot2 = RotationMatrix[{{0, 0, 1}, z2}] 

Get $4\times 4$ transformation matrices:

T1 = Join[MapThread[Append, {Rot1, b1}], {{0, 0, 0, 1}}] T2 = Join[MapThread[Append, {Rot2, b2}], {{0, 0, 0, 1}}] T21 = T2 . Inverse[T1] 
{r1, l1, r2, l2} = {0.1, Norm[b1 - t1], 0.1, Norm[b2 - t2]}; t21 = (T21 . {0, 0, 0, 1})[[1 ;; 3]]; 

The distances between the points don't hold. They should remain the same after transformation.

Norm[b2 - b1] Norm[t21] 

Position and orientation of line segments after transformation

Show[Graphics3D[{Cylinder[{{0, 0, 0}, {0, 0, l1}}, r1]}], Graphics3D[Cylinder[{t21, (T21 . {0, 0, l2, 1})[[1 ;; 3]]}, r2]], Boxed -> False] 

Position and orientation of line segments after transformation

Position and orientation of line segments before transformation

Show[Graphics3D[{Cylinder[{b1, t1}, r1]}], Graphics3D[Cylinder[{b2, t2}, r1]], Boxed -> False] 

Position and orientation of line segments before transformation

The two figures look different from each other. Also, distance between points are not maintained. Am I using RotationMatrix correctly? Also, I might be wrong about mathematical concept of transformation.

We have two line segments specified by a pair of points $(b_1,t_1)$, and $(b_2,t_2)$. We want to find the transformation between the two line segments. Define a unit vector $z_1$ from $b_1$ and pointing towards $t_1$. Similarly, define $z_2$. Then, I want to find some translation vector and rotation matrix, such that any point in $z_2$ can be expressed in terms from $z_1$. I understand that the problem is slightly ill-posed because there can be multiple solutions.

Define points and get rotation matrices:

b1 = {1, 0, 1}; t1 = {1, 2, 1}; b2 = {0, 1, 0}; t2 = {1, 1, 0}; z1 = (t1 - b1)/Norm[(t1 - b1)]; z2 = (t2 - b2)/Norm[(t2 - b2)]; Rot1 = RotationMatrix[{{0, 0, 1}, z1}] Rot2 = RotationMatrix[{{0, 0, 1}, z2}] 

Get $4\times 4$ transformation matrices:

T1 = Join[MapThread[Append, {Rot1, b1}], {{0, 0, 0, 1}}] T2 = Join[MapThread[Append, {Rot2, b2}], {{0, 0, 0, 1}}] T21 = T2 . Inverse[T1] 
{r1, l1, r2, l2} = {0.1, Norm[b1 - t1], 0.1, Norm[b2 - t2]}; t21 = (T21 . {0, 0, 0, 1})[[1 ;; 3]]; 

The distances between the points don't hold. They should remain the same after transformation.

Norm[b2 - b1] Norm[t21] 

Position and orientation of line segments after transformation

Show[Graphics3D[{Cylinder[{{0, 0, 0}, {0, 0, l1}}, r1]}], Graphics3D[Cylinder[{t21, (T21 . {0, 0, l2, 1})[[1 ;; 3]]}, r2]], Boxed -> False] 

Position and orientation of line segments after transformation

Position and orientation of line segments before transformation

Show[Graphics3D[{Cylinder[{b1, t1}, r1]}], Graphics3D[Cylinder[{b2, t2}, r1]], Boxed -> False] 

Position and orientation of line segments before transformation

The two figures look different from each other. Also, distance between points are not maintained. Am I using RotationMatrix correctly? Also, I might be wrong about mathematical concept of transformation.

Edit(Clarification): Consider a coordinate system {1} such that $z_1$ (line segment 1) is aligned with the $z$-axis of the coordinate system {1} and origin at $b_1$. Similarly, let $z$-axis of coordinate system {2} align with $z_2$ (line segment 2) and origin at $b_2$. Then I want to express the second line segment in terms of the coordinate system {1} in the form of some translation and rotation.

Source Link
Marvin
  • 614
  • 4
  • 11
Loading