[vtkusers] Obtaining transformation matrix for vtkPolyData

Eric Petersen peer9802 at gmail.com
Fri Aug 18 16:50:38 EDT 2017


Thanks David,

I've got a class setup for reading/writing STL files along with basic
manipulation.  My rotation code is below and called successive times.  I
guess the question is does VTK "remember" past transformations on a
vtkPolyData object()?  If so, what's the best way of accessing them?

def Rotate(self, alpha, beta, gamma):
        t = vtk.vtkTransform()
        t.RotateX(alpha)
        t.RotateY(beta)
        t.RotateZ(gamma)
        tf = vtk.vtkTransformPolyDataFilter()
        tf.SetInputData(self.MeshData)
        tf.SetTransform(t)
        tf.Update()
        self.MeshData.ShallowCopy(tf.GetOutput())

On Fri, Aug 18, 2017 at 8:33 AM, David E DeMarle <dave.demarle at kitware.com>
wrote:

> Howdy Eric,
>
> How are you doing the transform?
> * vtkTransformFIlter?
> * vtkActor::Transform?
> * manually changing the points in the vtkPolyData object?
>
> For either of the first two you can get the current matrix (and its
> inverse) from the transform object.
>
> hope that helps
>
>
> David E DeMarle
> Kitware, Inc.
> Principal Engineer
> 21 Corporate Drive
> Clifton Park, NY 12065-8662
> Phone: 518-881-4909 <(518)%20881-4909>
>
> On Fri, Aug 18, 2017 at 8:11 AM, Eric Petersen <peer9802 at gmail.com> wrote:
>
>> Hello,
>>
>> I currently have a Python script where I am successively translating, and
>> rotating, a vtkPolyData object.  The script currently does not track
>> individual transforms but I would like to know the current 4x4 transform
>> matrix.  Is there any way to directly obtain this information from the
>> vtkPolyData object or am I stuck rewriting the script to track individual
>> transformations?
>>
>> _______________________________________________
>> 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
>>
>> Search the list archives at: http://markmail.org/search/?q=vtkusers
>>
>> Follow this link to subscribe/unsubscribe:
>> http://public.kitware.com/mailman/listinfo/vtkusers
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20170818/8de6ab5a/attachment.html>


More information about the vtkusers mailing list