Nil Goyette
2017-06-20 15:24:15 UTC
Hi all,
Lets start by saying that I know "Reinit" is not the right choice of
word in this case! A reinit would reset the axis, as it should. Lets
say, for the sake of the discussion, that I want a reinit that simply
update the scene's bounding box, nothing else, like [1] to [2] (made by
hand, so not exact!):
- No camera modification, so everything is still at the same place
- Keep the axis rotated if they were
- Resize the scene if an object was added/deleted
I tried adding this snippet in RenderingManager::InitializeViews. In
clear english: reuse the old geometry for the current plane, but update
it with the new offset and bounds that we just calculated.
auto newGeo = timeGeometry->GetGeometryForTimeStep(0);
auto oldTimeGeo = nc->GetCreatedWorldGeometry();
auto oldGeo = oldTimeGeo->GetGeometryForTimeStep(0);
oldGeo->GetIndexToWorldTransform()->SetOffset(
newGeo->GetIndexToWorldTransform()->GetOffset());
oldGeo->SetBounds(newGeo->GetBounds());
nc->SendCreatedWorldGeometryUpdate();
nc->SetInputWorldTimeGeometry(oldTimeGeo);
nc->Update();
...
This doesn't work; it throws the planes in strange places [3], probably
because I broke their affine matrix. I tried many things but my biggest
success was to remove the call to SetInputWorldTimeGeometry [4]. I
checked in DisplayInteractor::Rotate to see if there was a way to find
the old rotation applied to the plane but it doesn't seem to be possible.
Anyway, I'm mostly wondering how YOU, the mitk experts :), would do it.
Thank you for your time.
Nil
[1] Loading Image...
[2] Loading Image...
[3] Loading Image...
[4] Loading Image...
Lets start by saying that I know "Reinit" is not the right choice of
word in this case! A reinit would reset the axis, as it should. Lets
say, for the sake of the discussion, that I want a reinit that simply
update the scene's bounding box, nothing else, like [1] to [2] (made by
hand, so not exact!):
- No camera modification, so everything is still at the same place
- Keep the axis rotated if they were
- Resize the scene if an object was added/deleted
I tried adding this snippet in RenderingManager::InitializeViews. In
clear english: reuse the old geometry for the current plane, but update
it with the new offset and bounds that we just calculated.
auto newGeo = timeGeometry->GetGeometryForTimeStep(0);
auto oldTimeGeo = nc->GetCreatedWorldGeometry();
auto oldGeo = oldTimeGeo->GetGeometryForTimeStep(0);
oldGeo->GetIndexToWorldTransform()->SetOffset(
newGeo->GetIndexToWorldTransform()->GetOffset());
oldGeo->SetBounds(newGeo->GetBounds());
nc->SendCreatedWorldGeometryUpdate();
nc->SetInputWorldTimeGeometry(oldTimeGeo);
nc->Update();
...
This doesn't work; it throws the planes in strange places [3], probably
because I broke their affine matrix. I tried many things but my biggest
success was to remove the call to SetInputWorldTimeGeometry [4]. I
checked in DisplayInteractor::Rotate to see if there was a way to find
the old rotation applied to the plane but it doesn't seem to be possible.
Anyway, I'm mostly wondering how YOU, the mitk experts :), would do it.
Thank you for your time.
Nil
[1] Loading Image...
[2] Loading Image...
[3] Loading Image...
[4] Loading Image...