[vtkusers] Convert vtkPolyData to vtkPoints

David Doria daviddoria at gmail.com
Thu Feb 9 19:59:21 EST 2012


On Thu, Feb 9, 2012 at 7:52 PM, Bayliss, Chris (Chicago)
<cbayliss at gnresound.com> wrote:
> Hi,
>
>
>
> Does anyone know how to convert vtkPolyData to vtkPoints?  I am having
> trouble figuring out how to deal with converting different data types in
> general, is there a good explanation of how to do this somewhere?
>
>
>
> I am trying to import a list of vtkPolyData points in order to use them in
> vtkThinPlateSplineTransform.  The point data file is below.
>
>
>
>
>
> Points data file:
>
>
>
> # vtk DataFile Version 3.0
>
> vtk output
>
> ASCII
>
> DATASET POLYDATA
>
> POINTS 8 float
>
> 4.59051 13.9937 -10.0349 -3.7962 18.3532 -8.86511 1.09064 5.30224 -6.2456
>
> -9.33379 6.54881 -9.28031 -12.7811 3.69209 -8.08974 -11.3976 6.21781 3.36158
>
> -1.03919 3.50322 5.165 7.21133 7.95248 2.11749
>
> VERTICES 8 16
>
> 1 0
>
> 1 1
>
> 1 2
>
> 1 3
>
> 1 4
>
> 1 5
>
> 1 6
>
> 1 7
>
>
>
> POINT_DATA 8
>
> SCALARS scalars float
>
> LOOKUP_TABLE default
>
> 1 1 1 1 1 1 1 1
>
>
>
> Thanks
>
>
>
> Chris

This is not a conversion, but rather an extraction:

vtkPoints* points = polydata->GetPoints()

Other conversions are much harder/confusing. Searching for "convert"
at http://www.vtk.org/Wiki/VTK/Examples/Cxx may help you with some.

David



More information about the vtkusers mailing list