[vtkusers] Obtaining transformation matrix for vtkPolyData
david.gobbi at gmail.com
Fri Aug 18 17:50:17 EDT 2017
The typical solution is to save the transform. Make it into a member of
your class. It's convenient to have the transform filter as a member, too.
self.MeshTransform = vtk.vtkTransform()
self.MeshTransformFilter = vtk.vtkTransformPolyDataFilter()
self.MeshTransformFilter.SetInput( < insert original, untransformed
data here> )
def Rotate(self, alpha, beta, gamma):
The idea here is to keep a copy of your original, unmodified data to use as
input to vtkTransformPolyData, though depending on what other kinds of
editing you are doing, this might be tricky.
On Fri, Aug 18, 2017 at 2:50 PM, Eric Petersen <peer9802 at gmail.com> wrote:
> 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()
> tf = vtk.vtkTransformPolyDataFilter()
> 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>
>>> 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
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the vtkusers