[vtkusers] vtkTextActor align to center of text

M. Jordan mjordan at live.at
Thu Feb 9 06:37:05 EST 2017


Hi,

I am creating a 3D text like this:


// create text
vtkSmartPointer<vtkVectorText> textSource =
 vtkSmartPointer<vtkVectorText>::New();
textSource->SetText("TEST");
textSource->Update();
// create a mapper for the text
vtkSmartPointer<vtkPolyDataMapper> txtmapper =
 vtkSmartPointer<vtkPolyDataMapper>::New();
 txtmapper->SetInputConnection(transformFilter->GetOutputPort());
// create a subclass of vtkActor: a vtkFollower that remains facing the camera
vtkSmartPointer<vtkFollower> follower =
vtkSmartPointer<vtkFollower>::New();
follower->SetMapper(txtmapper);
 follower->SetCamera(renderer->GetActiveCamera());
 follower->SetPosition(10.0,20.0,30.0);

Now the passed follower position is approximately the bottom left corner of my text.

How can I achieve a text which is centered about my desired position?
For example the text "101" should result in a 3D text with the center being located in the middle of the "0"

Thank you very much!


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20170209/8a81486b/attachment.html>


More information about the vtkusers mailing list