# Transform matrix of vtkboxwidget2 is different calculated

**URL:** https://discourse.vtk.org/t/transform-matrix-of-vtkboxwidget2-is-different-calculated/4235
**Category:** Support
**Created:** [September 17, 2020, 7:54am UTC](https://discourse.vtk.org/t/transform-matrix-of-vtkboxwidget2-is-different-calculated/4235 "2020-09-17T07:54:35Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![zandarina](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/z/4af34b/32.png) [@zandarina](https://discourse.vtk.org/u/zandarina)
#### Post date: [September 17, 2020, 7:54am UTC](https://discourse.vtk.org/t/transform-matrix-of-vtkboxwidget2-is-different-calculated/4235/1 "2020-09-17T07:54:35Z")

</div>

Hello,

I amb trying to understand the transformation matrix of the vtkboxwidget2. I want to have a bounding box widget with only translations. In some transformations the matrix gives the initial position and updates it from it. So what I do is to get the position and the previous to obtain the difference to get the translation that it is what I want to track.

But in some cases I do not get the position if not an offset. Why this changes?.Only the translation is allowed and they are formed in the same way.

For example 114 is the heigh:

vtkMatrix4x4 (0000029850AD9AD0)  
Debug: Off  
Modified Time: 1098166  
Reference Count: 1  
Registered Events: (none)  
Elements:  
1 0 0 -41.4137  
0 1 0 0  
0 0 1 114.535  
0 0 0 1

But some others 114 becomes offsets as for example

vtkMatrix4x4 (000001A1E6C378A0)  
Debug: Off  
Modified Time: 4576873  
Reference Count: 1  
Registered Events: (none)  
Elements:  
1 0 0 -0.364876  
0 1 0 -0.940811  
0 0 1 -2.26909  
0 0 0 1

so in this case I cannot get the translation as I did before. Any idea?. Thanks !!. The code is as follows

```
	vtkNew<vtkBoxWidget2> widget;
	vtkSmartPointer<RigidBoxRepresentation> 
            rigidBody_rep = 
               vtkSmartPointer
             <RigidBoxRepresentation>::New();
	auto interactor = view_mgr_.lock()->
            get_volume_render_window()
            ->GetInteractor();
	widget->SetInteractor(interactor);
	rigidBody_rep->SetPlaceFactor(1);
	   
            rigidBody_rep->
          PlaceWidget
          (actor_->GetBounds());
	widget->ScalingEnabledOff();
	widget->RotationEnabledOff();
	widget->MoveFacesEnabledOff();
	widget->SetRepresentation(rigidBody_rep);
	widget->Modified();
	
	cout << "New bounding box \n";
	vtkNew<vtkBoxCallback> callback;
	callback->set_actor(actor_);

	widget->
           AddObserver(vtkCommand::InteractionEvent, 
          callback);
	widget->AddObserver
                (vtkCommand::EndInteractionEvent,
           callback);
	widget->On();
```
