[vtk-developers] bounds calculation in vtkActor

Rusty Blue rusty.blue at kitware.com
Wed Oct 27 20:29:30 EDT 2010


Folks,

 

We're setting the UserMatrix of an actor to... surprise, surprise...
transform the actor.  Nothing exciting, right?  

 

Wrong, because the last row of our matrix is not the trivial [0 0 0 1].
This is handled well enough in OpenGL, but the bounds calculation (in
vtkActor::GetBounds()) is seriously wrong because it is doing a linear
transformation of the bbox it gets from the mapper (Transform is a
vtkLinearTransform):

 

    fptr = bbox;

    for (n = 0; n < 8; n++) 

      {

      this->Transform->TransformPoint(fptr,fptr);

      fptr += 3;

      }

 

The easiest fix I found for the issue was the following (force call to
InternalTransformPoint of vtkHomogeneousTransform):

 

    fptr = bbox;

    this->Transform->Update();

    for (n = 0; n < 8; n++) 

      {

 
this->Transform->vtkHomogeneousTransform::InternalTransformPoint(fptr,fptr);

      fptr += 3;

      }

 

The change doesn't cause any tests to fail (for me)... and it seems like a
reasonable change (perhaps should be made in vtkImageActor and vtkVolume as
well?)... but I wanted to put it out there (before I committed and pushed
the change), because it is seriously likely that I'm not considering some
other special "situations", or perhaps the "right" way to fix this, or ????

 

Rusty

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20101027/b207187c/attachment.html>


More information about the vtk-developers mailing list