[vtkusers] vtkFollower/vtkVectorText and SetScale Problem...
Jeff Lee
jeff at cdnorthamerica.com
Tue Jul 13 15:46:03 EDT 2004
Hi Andrea,
Try vtkTextActor. You can make it use scaled text (as a fraction of
viewport height) and position it in world coordinates(it will follow
that world coordinate, and always face the camera). Have a look at the
vtk examples for vtkTextActor linked from the man pages.
-Jeff
Andrea Gavana wrote:
>No one has a solution? I thought that many people use vtkVectorText +
>vtkFollower for 3D applications... and I think that the use of SetScale is
>wide... if I reformulate the question:
>
>How can I adjust the scale of vtkVectorText (or vtkFollower) when I use
>SetScale on other actors (wireframe, surfaces...) in order to let vtkVectorText
>mantain its correct position? And first of all, is this possible? And if I can
>not, is this a bug/undocumented "feature" of vtkVectorText/vtkFollower?
>
>It is really important, if someone else has a different solution (also with
>other vtk actors) in order to obtain the same result, everything is welcome.
>
>Thank you for every suggestion.
>
>Andrea.
>
>Selon Andrea Gavana <andrea.gavana at polymtl.ca>:
>
>
>
>>Hello Paul,
>>
>> unfortunately, this does not help me a lot... I use a vtkFollower
>>together with a vtkVectorText, that is a bit different wrt what you are doing
>>
>>(or at least it seems different to me). Now I am able to correctly give the
>>position to the vtkFollower, but when I change the Scale of other actors
>>(like
>>a 3D surface, wireframe, polydata line and so on), the vtkVectorText goes up,
>>
>>far away from the original position, and there is no way to get it at the
>>correct position. What I do is:
>>
>>atext = vtkpython.vtkVectorText()
>>atext.SetText("MY WELL")
>>textMapper = vtkpython.vtkPolyDataMapper()
>>textMapper.SetInput(atext.GetOutput())
>>textActor = vtkpython.vtkFollower()
>>textActor.SetMapper(textMapper)
>>
>># 3D GRID EXTENSION
>>xmin, xmax, ymin, ymax, zmin, zmax = actsurface.GetBounds()
>>
>># HERE I SET THE VTKVECTORTEXT SCALE WRT THE 3D GRID EXTENSION
>>scale = max((xmax-xmin),(ymax-ymin),(zmax-zmin))/100.0
>>
>>textActor.GetProperty().SetColor(1,1,1)
>>xmin, xmax, ymin, ymax, zmin, zmax = textActor.GetBounds()
>>xl = (xmax - xmin)/2.0
>>yl = (ymax - ymin)/2.0
>>zl = (zmax - zmin)/2.0
>>
>>textActor.SetScale(scale,scale,scale)
>>textActor.SetPosition(self.wellt[0,0]-xl,self.wellt[0,1]-yl,(self.wellt[0,2]-
>>zl))
>>
>>When I change the scale of the other actors, the vtkvectortext gets messed
>>up,
>>no matter what I do... I can change its scale, its position, nothing
>>happens...
>>Does anyone have a suggestion? It starts to appear to me like a bug.
>>
>>Thanks for your suggestions.
>>
>>Andrea.
>>
>>
>>
>
>_______________________________________________
>This is the private VTK discussion list.
>Please keep messages on-topic. Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
>Follow this link to subscribe/unsubscribe:
>http://www.vtk.org/mailman/listinfo/vtkusers
>
>
>
>
More information about the vtkusers
mailing list