[vtkusers] How to draw lines between two datasets using VTK
David Doria
daviddoria at gmail.com
Sat Nov 19 08:57:28 EST 2011
On Sat, Nov 19, 2011 at 8:44 AM, dev <work2compilation at gmail.com> wrote:
> Hi vtkusers,
>
> I'm newer at vtk, so I hope that I'll find help here :)
>
> I have two datasets of vtkPolyData* type:
>
> Data_source and Data_target.
>
> I calculated the correspondences between Data_source and Data_target and I
> have points (x_source,y_source,z_source) which match
> (x_target,y_target,z_target). Now
> my question is:
>
> 1-How to draw lines ,between to datasets, that rely
> (x_source,y_source,z_source) to **(x_target,y_target,z_target)**?
>
> 2-How to display them on a vtk window?
>
> Greetings
>
> W
There is no "draw lines from one point set to another" in VTK. What
you'll have to do is put all the points into one vtkPoints object
(either
target_1, target_2, ..., target_N, source_1, source_2, source_N
or
target_1, source_1, target_2, source_2, target_N, source_N
(your choice).
You then have to create the lines between the corresponding points with:
line->GetPointIds()->SetId(0,target_point);
line->GetPointIds()->SetId(1,source_point);
according to the format you chose to store the points. A full example
of making and displaying lines here:
http://www.vtk.org/Wiki/VTK/Examples/Cxx/GeometricObjects/ColoredLines
David
More information about the vtkusers
mailing list