[vtkusers] vtkTransform: doesn't work for long distance translation

Alexey Pechnikov pechnikov at mobigroup.ru
Thu Dec 14 11:10:32 EST 2017


This sample code works correct:

transform = vtk.vtkTransform()
transform.Translate(0, 100, 0)

but the same code produces bad geometry:

transform = vtk.vtkTransform()
transform.Translate(0,10000000, 0)

P.S. Yes, I really need y=10000000 for GIS data. And I can use the same
coordinates for VTK data arrays without any problem.


There is the full test script below:

import sys

sys.path.append("/usr/local/Cellar/vtk/8.0.1_1//lib/python2.7/site-packages/vtk/")


import vtk


text = vtk.vtkVectorText()

text.SetText('PLD003')


# Set up a transform to move the label to a new position.

transform = vtk.vtkTransform()

transform.Identity()

transform.Translate(0, 10000000, 0)

#transform.Translate(100,100,100)


transformFilter = vtk.vtkTransformPolyDataFilter()

for x in range(100):

    transformFilter.SetTransform(transform)

transformFilter.SetInputConnection(text.GetOutputPort())


writer = vtk.vtkXMLPolyDataWriter()

writer.SetInputConnection(transformFilter.GetOutputPort())

writer.SetFileName('text.vtp')

writer.SetDataModeToAscii()

writer.Write()


-- 
Best regards, Alexey Pechnikov.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://vtk.org/pipermail/vtkusers/attachments/20171214/780fa4e8/attachment.html>


More information about the vtkusers mailing list