[vtkusers] Text orientation

David Gobbi dgobbi at irus.rri.on.ca
Mon Mar 12 17:09:44 EST 2001


Hi Nicolas,

There are questions that you might be asking, so I'll answer them
both.

First, I don't think this is what you mean, but to write
vertical text like
  T
  E
  X
  T
you can just put a "\n" after each letter, e.g.
  text = vtkVectorText()
  text.SetText("T\nE\nX\nT")

In order to take a piece of horizontal text and rotate it to any
orientation (I'm guessing that this is what you want to do) you
can use vtkTransformPolyDataFilter

  text = vtkVectorText()
  text.SetText("TEXT")
  transform = vtkTransform()
  transform.Translate(x,y,z) # set coords for text
  transform.RotateX(90.0)    # change orientation
  transform.Scale(10,10,10)  # apply whatever scale you want to use
  transformFilter = vtkTransformPolyDataFilter()
  transformFilter.SetInput(text.GetOutput())
  transformFilter.SetTransform(transform)

You can also do the translation/rotation/scaling to the vtkActor 
instead of to the data.  Also, it can be useful to use vtkFollower
in place of vtkActor if you always want the text to face the
camera.

 - David

--
  David Gobbi, MSc                    dgobbi at irus.rri.on.ca
  Advanced Imaging Research Group
  Robarts Research Institute, University of Western Ontario

On Mon, 12 Mar 2001, Nicolas Mangon wrote:

> Hello,
> 
> What I mean is by Is it possible to change the
> orientation of 2D text annotations instead of being
> always horizontal, is can we rotate the text along any
> axis, not only vertical.
> 
> Thanks
> 





More information about the vtkusers mailing list