[vtkusers] Fwd: Transform polydata with double precision (vtk, python)

Cory Quammen cory.quammen at kitware.com
Tue Aug 18 13:17:07 EDT 2015


pgt.SetOutputPointsPrecision(vtkAlgorithm::DOUBLE_PRECISION )

should work. Let us know if it doesn't.

On Tue, Aug 18, 2015 at 11:07 AM, Jaap Verheggen <jpmverheggen at gmail.com>
wrote:

>
>
> 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
>
>
>
>
> _______________________________________________
> 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
>
>


-- 
Cory Quammen
R&D Engineer
Kitware, Inc.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20150818/8c96bfe0/attachment.html>


More information about the vtkusers mailing list