[vtk-developers] bounds calculation in vtkActor

David Gobbi david.gobbi at gmail.com
Wed Oct 27 22:52:08 EDT 2010


Hi Rusty,

I think that changing to a vtkPerspectiveTransform is the right thing
from a pure design perspective.  It's probably the wrong choice with
respect to time spent and has potential to introduce new bugs or
backwards compatibilities, but I'm just uncomfortable with the idea of
a vtkTransform carrying a payload that is not a linear transform.  But
since vtkProp3D::Transform is completely internal to vtkProp3D and its
subclasses, it might be okay to make an exception if it is properly
documented.

It would be interesting to know how many people have had problems with
vtkActor only allowing linear transforms.

  David


On Wed, Oct 27, 2010 at 8:13 PM, Aashish Chaudhary
<aashish.chaudhary at kitware.com> wrote:
> I meant What Rusty said.. sorry
>
> On Wed, Oct 27, 2010 at 10:12 PM, Aashish Chaudhary
> <aashish.chaudhary at kitware.com> wrote:
>> Bill,
>>
>> On Wed, Oct 27, 2010 at 8:35 PM, Bill Lorensen <bill.lorensen at gmail.com> wrote:
>>
>> What Rusty (in his reply) +
>>
>>> Rusty,
>>>
>>> I would think it should be consistent across ImageActor and Volume.
>>
>> I agree but I guess it would be nice to know if someone else ran into
>> similar issues (yes / no). It is hard to imagine though but not
>> impossible. When I worked on a project (8 months back with Rusty) I
>> took control over the matrix multiplication and division by
>> homogeneous coordinate and hence this problem never showed up.
>>
>>> I
>>> also suggest you push it to Gerrit for code review. And you should
>>> provide or modify a test to illustrate it.
>>
>> Would you prefer test to go to the Gerrit or  in the email thread?
>>>
>>> Bill
>>>
>>> On Wed, Oct 27, 2010 at 8:29 PM, Rusty Blue <rusty.blue at kitware.com> wrote:
>>>> 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
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> Powered by www.kitware.com
>>>>
>>>> Visit other Kitware open-source projects at
>>>> http://www.kitware.com/opensource/opensource.html
>>>>
>>>> Follow this link to subscribe/unsubscribe:
>>>> http://www.vtk.org/mailman/listinfo/vtk-developers
>>>>
>>>>
>>>>
>>> _______________________________________________
>>> Powered by www.kitware.com
>>>
>>> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>>>
>>> Follow this link to subscribe/unsubscribe:
>>> http://www.vtk.org/mailman/listinfo/vtk-developers
>>>
>>>
>>
>>
>>
>> --
>> | Aashish Chaudhary
>> | R&D Engineer
>> | Kitware Inc.
>> | www.kitware.com
>>
>
>
>
> --
> | Aashish Chaudhary
> | R&D Engineer
> | Kitware Inc.
> | www.kitware.com
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtk-developers
>
>



More information about the vtk-developers mailing list