[vtkusers] VTK slow to display 300 vtkArrowSource in real-time
David Lonie
david.lonie at kitware.com
Thu Oct 13 09:32:59 EDT 2016
On Thu, Oct 13, 2016 at 7:54 AM, Olivier Ameline <olivameline at gmail.com>
wrote:
> Thanks, it's working with vtkGlyph3D : I can position and orientate the 300
> arrows with only one actor.
>
> But now, I'm trying to add labels that follow the arrows.
> I was doing this with vtkVectorTexts, but this requires to define 300
> vtkFollowers.
>
> Is there also a way to define only one vtkFollower ?
>
> I tried to put the vtkVectorTexts in a vtkGlyph3D, and define ony one
> follower for the entire vtkGlyph3D,
> but only the first vtkVectorText follows its arrow.
>
Sounds like vtkLabeledDataMapper could do what you want:
http://www.vtk.org/doc/nightly/html/classvtkLabeledDataMapper.html#details
It looks like it can take a 3D dataset and render arbitrary strings at each
point. So you should be able to:
1) Create a dataset that has points where you want the labels.
2) Create a vtkStringArray containing the labels (in the same order as the
points) and add this to the dataset via dataset->GetFieldData()->AddArray()
(be sure to give the array a unique name with SetName).
3) Set:
- labeledDataMapper->SetLabelModeToLabelFieldData()
- labeledDataMapper->SetFieldDataName(labelArray->GetName())
The vtkLabeledDataMapper is then connected to a single vtkActor2D, and will
render the text in the overlay plane on top of the geometry, no vtkFollower
needed. You can use a vtkSelectVisiblePoints filter if you want to hide
labels on occluded points.
HTH,
Dave
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20161013/4e4b9882/attachment.html>
More information about the vtkusers
mailing list