[vtkusers] Problem with transformation

David Gobbi david.gobbi at gmail.com
Fri Feb 26 10:48:17 EST 2010


Hi Andrea,

It's just the wrong DeepCopy.  You want to do this:

transfMatrix->DeepCopy(matrixElements);

The other DeepCopy (the one that you were using) copies transfMatrix
to matrixElements, i.e. it copies in the opposite direction.

   David


vtkMatrix4x4::DeepCopy(matrixElements, trasfMatrix);

On Fri, Feb 26, 2010 at 7:51 AM, Andrea Bottino
<andrea.bottino at polito.it> wrote:
> Hello everybody,
>
> I have a problem with transformations. Taken a vtkPolyData (source), if I
> specify a transformation using Translate it works:
>
>
>   vtkTransform* transform = vtkTransform::New();
>   transform->Translate(-B[0], -B[1], -B[2]);
>
>   vtkTransformPolyDataFilter* tf = vtkTransformPolyDataFilter::New();
>   tf->SetInput(source);
>   tf->SetTransform(transform);
>   tf->Update();
>
>   drawPolyData(tf->GetOutput());
>
> (here model is correctly tanslated). If I try to specify the matrix, nothing
> works:
>
>   double matrixElements[16] = {
>     1,    0,    0,    -B[0],
>     0,    1,    0,    -B[1],
>     0,    0,    1,    -B[2],
>     0,    0,    0,    1     };
>
>   vtkMatrix4x4* trasfMatrix = vtkMatrix4x4::New();
>   vtkMatrix4x4::DeepCopy(matrixElements, trasfMatrix);
>
> matrix stays as identity...
>
> if I set manually the values with SetElements, it works...
> Am I doing something wrong?
>
> bye,
> a.
>
> --
> Andrea Bottino
> Politecnico di Torino, DAUIN
> Corso Duca degli Abruzzi, 24
> 10129 Torino ITALY
> Tel +39 011 5647175 / Fax +39 011 5647099.
> http://www.polito.it/cgvg
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>



More information about the vtkusers mailing list