[vtkusers] rotate a vtkUnstructuredGrid by angles

David Doria daviddoria at gmail.com
Sat Nov 27 09:45:53 EST 2010


On Sat, Nov 27, 2010 at 9:08 AM, Luca Penasa <luca.penasa at email.it> wrote:
> hi everybody,
>
>        i have a vtkUnstructuredGrid that roughly describe a surface, i want to
> rotate my cloud so that the normal of the best fit plane for the cloud
> (that i calculate with a function i wrote - like [0.57452031,
> -0.65909439,  0.48405198]) will becames parallel with an arbitrary axis
> (for esample with the z axis: [0,0,1]).
>
> what is the best way to obtain that?
> is there any dedicate function in vtk?
>
> Thanks!

I would make a vtkLandmarkTransform with two sets of two points:

Source: (0,0,0) and the source vector (.57452031, -0.65909439,  0.48405198)
Target: (0,0,0) and the destination vector (0,0,1)

Use the transform that is computed with a vtkTransformFilter to
transform the original data.

Here are some relevant examples:
http://www.vtk.org/Wiki/VTK/Examples/Cxx/Filters/LandmarkTransform
http://www.vtk.org/Wiki/VTK/Examples/Cxx/PolyData/TransformFilter

Good luck.

David



More information about the vtkusers mailing list