# SetModelTransformMatrix changes the z-coordinate of the translation vector

**URL:** https://discourse.vtk.org/t/setmodeltransformmatrix-changes-the-z-coordinate-of-the-translation-vector/1738
**Category:** Development
**Created:** [September 10, 2019, 3:53pm UTC](https://discourse.vtk.org/t/setmodeltransformmatrix-changes-the-z-coordinate-of-the-translation-vector/1738 "2019-09-10T15:53:36Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![haho](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/h/958977/32.png) [@haho](https://discourse.vtk.org/u/haho)
#### Post date: [September 10, 2019, 3:53pm UTC](https://discourse.vtk.org/t/setmodeltransformmatrix-changes-the-z-coordinate-of-the-translation-vector/1738/1 "2019-09-10T15:53:36Z")

</div>

I just came across the following subtlety:

I set the model transform matrix with the command \_curRendererL-\>GetActiveCamera()-\>SetModelTransformMatrix(F\_EA\_L);

Then I mark the camera as modified and Render the scene:  
\_curRendererL-\>GetActiveCamera()-\>Modified();  
\_renderWindowL-\>Render();

Now, I read the model transform matrix and write both the original F\_EA\_L and the read one to the console:  
vtkMatrix4x4\* mvL = \_curRendererL-\>GetActiveCamera()-\>GetModelViewTransformMatrix();

for (int i = 0; i \< 4; i++) { for (int j = 0; j \< 4; j++) std::cout \<\< mvL-\>GetElement(i, j) \<\< " "; std::cout \<\< std::endl; }  
for (int i = 0; i \< 4; i++) { for (int j = 0; j \< 4; j++) std::cout \<\< F\_EA\_L-\>GetElement(i, j) \<\< " "; std::cout \<\< std::endl; }

This is, what I get:  
-0.893959 0.446191 0.0418398 102.39  
0.164383 0.395993 -0.90342 -158.083  
-0.41968 -0.800769 -0.427362 -651.013  
0 0 0 1

-0.893959 0.446191 0.0418398 102.39  
0.164383 0.395993 -0.90342 -158.083  
-0.41968 -0.800769 -0.427362 -650.013  
0 0 0 1

Everything is fine except for the z-coordinate of the translation vector: The orginal matrix contained -650.013 the read matrix shows -651.013. And this is reproducible with arbitrary matrices - the z-coordinate is always 1.0 smaller than the original.

I am thankful for any hints that could solve this problem.
