[vtkusers] Fwd: Transform polydata with double precision (vtk, python)
Jaap Verheggen
jpmverheggen at gmail.com
Tue Aug 18 11:07:08 EDT 2015
Dear all,
I am trying to transform polydata using double precision using python
and vtk 5.
I can set the datatype for the points via points.SetDataTypeToDouble() .
I create a surface using Delaunay.
Using delaunay.GetOutput().GetPoints().GetDataType() I can check that I
still have double as datatype (11)
After the transformation, the datatype is float,
pgt.GetOutput().GetPoints().GetDataType() gives float (10)
How can I transform the polydata keeping double precision?
Thanks in advance for your answer
Code:
points = vtk.vtkPoints()
points.SetDataTypeToDouble()
vertices = vtk.vtkCellArray()
------ # Fill points and vertices with data
# Create a polydata object
point_pd = vtk.vtkPolyData()
# Set the points and vertices as the geometry and topology of the
polydata
point_pd.SetPoints(points)
point_pd.SetVerts(vertices)
# make the delaunay mesh
boundary = vtk.vtkPolyData()
boundary.SetPoints(point_pd.GetPoints())
boundary.SetPolys(vertices)
delaunay = vtk.vtkDelaunay2D()
delaunay.SetInput(point_pd)
delaunay.SetSource(boundary)
delaunay.Update()
# Rotate
rotate = vtk.vtkTransform()
rotate.RotateWXYZ(5.0, 0, 0, 1)
pgt=vtk.vtkTransformPolyDataFilter()
pgt.SetTransform(rotate)
pgt.SetInput(delaunay.GetOutput())
pgt.Update()
--
---------------------------
Jaap Verheggen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20150818/ababc928/attachment.html>
More information about the vtkusers
mailing list