[vtkusers] How to write a polyline in VTK?

Jim Peterson jimcp at cox.net
Thu Oct 7 17:34:30 EDT 2010


>
> # vtk DataFile Version 2.1
> parabola - polyline
> ASCII
>           
> DATASET POLYDATA
> POINTS      11 float
>    0.0000000E+00  0.0000000E+00  0.0000000E+00
>     1.000000      0.1000000      0.0000000E+00
>     2.000000      0.4000000      0.0000000E+00
>     3.000000      0.9000000      0.0000000E+00
>     4.000000       1.600000      0.0000000E+00
>     5.000000       2.500000      0.0000000E+00
>     6.000000       3.600000      0.0000000E+00
>     7.000000       4.900000      0.0000000E+00
>     8.000000       6.400000      0.0000000E+00
>     9.000000       8.100000      0.0000000E+00
>     10.00000       10.00000      0.0000000E+00
>
> LINES 1    12
>            11
>             0
>             1
>             2
>             3
>             4
>             5
>             6
>             7
>             8
>             9
>            10
>
>
> How should I write the "LINES" parameter for 2160 points?
>
> Att,
>
> Renan.
>
>
>
Renan,
Your example has 11 points and 12 line segments, point id 1 is the first 
point in the first line segment, point id 11 is the end point of the 
first segment, and the origin of the second, point 0 is the end of the 
second and start of the third an on.

if you have

POINTS 2160 float


followed by 2160 sets of xyz coordinates, you need

LINES 0 2160
            1
             2
         ...
       2159

to create line segments between the points in order. The point ids do 
not  need to be in order and can be repeated I believe.

HTH,
Jim



More information about the vtkusers mailing list