# Get relative translation and rotation of two models

**URL:** <https://discourse.slicer.org/t/get-relative-translation-and-rotation-of-two-models/8064>\
**Category:** Support\
**Created:** [August 16, 2019, 5:59pm UTC](https://discourse.slicer.org/t/get-relative-translation-and-rotation-of-two-models/8064 "2019-08-16T17:59:34Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [August 21, 2019, 3:40pm UTC](https://discourse.slicer.org/t/get-relative-translation-and-rotation-of-two-models/8064/7 "2019-08-21T15:40:06Z")

</div>

You can get Euler angles orientation matrix using this code snippet:

```python
transformNode = getNode('LinearTransform_3')
transformMatrix = vtk.vtkMatrix4x4()
transformNode.GetMatrixTransformToParent(transformMatrix)
transform = vtk.vtkTransform()
transform.SetMatrix(transformMatrix)
orientation = transform.GetOrientation()
print(orientation)

```

Note that the same orientation can be encoded using many different combinations of rotations, even Euler angles have many variants.

If you need to use a particular convention then you can implement the angle computations from the corresponding mathematical formulae directly you can access orientation matrix element in the `transformMatrix` object in the example above.

---

_[View the full topic](https://discourse.slicer.org/t/get-relative-translation-and-rotation-of-two-models/8064)._
