# Are UserTransforms going to be deprecated?

**URL:** <https://discourse.vtk.org/t/are-usertransforms-going-to-be-deprecated/9165>\
**Category:** Development\
**Created:** [August 17, 2022, 4:50pm UTC](https://discourse.vtk.org/t/are-usertransforms-going-to-be-deprecated/9165 "2022-08-17T16:50:31Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![rdbrn](https://discourse.vtk.org/user_avatar/discourse.vtk.org/rdbrn/32/5627_2.png) [@rdbrn](https://discourse.vtk.org/u/rdbrn)\
**Post date:** [August 17, 2022, 4:50pm UTC](https://discourse.vtk.org/t/are-usertransforms-going-to-be-deprecated/9165/1 "2022-08-17T16:50:31Z")

</div>

I’ve always been using SetUserTransform/Matrix to set the position of actors until I found something that didn’t work and I started looking for documentation of the UserTransform.  
Then I found this issue: [Document vtkActor’s UserTransform and UserMatrix limitations (#17807) · Issues · VTK / VTK · GitLab (kitware.com)](https://gitlab.kitware.com/vtk/vtk/-/issues/17807) stating that usertransforms should better not be used.

@ken-martin

Next question is: what would be the alternative? I have a transformation matrix already which I can now directly set the the actor. If not allowed to use usertransforms/matrices, then there does not seem to be a straight-forward way to set the transformation matrix of an actor.  
It can be set using GetMatrix()-\>SetElement() but the matrix gets overwritten when other properties of the actor are updated, guessing ComputeMatrix() is responsible for that.

In python, updating the transform of an actor from a matrix requires the following code:

```python
m0 = mat1.GetElement(0, 0)
m1 = mat1.GetElement(0, 1)
m2 = mat1.GetElement(0, 2)
m4 = mat1.GetElement(1, 0)
m5 = mat1.GetElement(1, 1)
m6 = mat1.GetElement(1, 2)
m8 = mat1.GetElement(2, 0)
m9 = mat1.GetElement(2, 1)
m10 = mat1.GetElement(2, 2)

scale1 = (m0 * m0 + m4 * m4 + m8 * m8) ** 0.5
scale2 = (m1 * m1 + m5 * m5 + m9 * m9) ** 0.5
scale3 = (m2 * m2 + m6 * m6 + m10 * m10) ** 0.5

actor.SetScale(scale1, scale2, scale3)

x = mat1.GetElement(0, 3)
y = mat1.GetElement(1, 3)
z = mat1.GetElement(2, 3)

actor.SetOrigin(0, 0, 0)
actor.SetPosition(x, y, z)

out = [0, 0, 0]
vtk.vtkTransform.GetOrientation(out, mat1)

actor.SetOrientation(*out)

```

(translated from vtkProp3d.cxx \> vtkProp3D::SetPropertiesFromModelToWorldMatrix)
