[vtkusers] Re: vtkTransform and SetMatrix() routine doesn't reflect in InternalMultiplyPoint

Greg Pintilie gregvtk at gmail.com
Sun Jan 8 20:47:31 EST 2006


Looks like I can answer my own question...
if I add a call to tr->MultiplyPoint before the InternalMultiply Point, tr
is updated and I get the right result:

        tr->MultiplyPoint ( pi, po );
        printf ("Pt: %f %f %f %f\n", po[0], po[1], po[2], po[3]);

doh... sorry for cluttering the list :/




On 1/8/06, Greg Pintilie <gregvtk at gmail.com> wrote:
>
>
> Say I have a vtkMatrix4x4 M, and I want to make a vtkTransform object have
> the same transform:
>
>         vtkTransform *tr = vtkTransform::New();
>         tr->SetMatrix ( M );
>
> Then I want to use this transform in a vtkBoxWidget:
>
>         boxWidget->SetTransform ( tr );
>
>
> The thing is, the widget doesn't have the same position and orientation as
> my original transform!
> Looking at the code, the widget uses the function
> tr->InternalTransformPoint, and when I checked it out using the following
> code:
>
>         double pi[4] = {1, 1, 1, 1};
>         double *po = M->MultiplyDoublePoint ( pi );
>         printf ("Pt: %f %f %f %f\n", po[0], po[1], po[2], po[3]);
>         tr->InternalTransformPoint ( pi, po );
>         printf ("Pt: %f %f %f\n", po[0], po[1], po[2]);
>
> I get the following output:
> Pt: 94.408877 -29.992743 2.359148 1.000000
> Pt: 1.000000 1.000000 1.000000
>
> So tr and M don't match. How do I make tr match M?
>
> Thanks for any help.
>
> Greg
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20060108/9f1374ea/attachment.htm>


More information about the vtkusers mailing list