[vtkusers] vtkTextActor align to center of text

M. Jordan mjordan at live.at
Fri Feb 10 04:18:13 EST 2017

Thank you very much!

I am using VTK 7.0 and I think vtkBillboardTextActor3D is not available in this version.
I tried vtkTextActor3D but I need a text which is always facing the camera.

I think it must be possible to calculate a new position point P' (bottom left corner) which leads to a text
whose center is at the desired position P.

I tried to use follower->getCenter() to get the center of the bounding box of my text. But now I don't know how to shift
the position point (bottom left corner) in a manner that the center point = my desired position.

Von: David Lonie <david.lonie at kitware.com>
Gesendet: Donnerstag, 09. Februar 2017 18:35
An: M. Jordan
Cc: vtkusers at vtk.org
Betreff: Re: [vtkusers] vtkTextActor align to center of text

You'll likely have better luck using vtkTextActor3D or
vtkBillboardTextActor3D. These have vtkTextProperties you can modify
to set things like justification/alignment.


On Thu, Feb 9, 2017 at 6:37 AM, M. Jordan <mjordan at live.at> wrote:
> 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!
> _______________________________________________
> Powered by www.kitware.com<http://www.kitware.com>

Kitware Inc. - leading edge, high-quality software<http://www.kitware.com/>
Kitware's mission is to create state-of-the-art software products and services in visualization and data processing using advanced quality software methods and ...

> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
OPEN SOURCE - Kitware<http://www.kitware.com/opensource/opensource.html>
Kitware develops, maintains and supports a wide array of toolkits and applications that are used by tens of thousands of software developers, researchers and ...

> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
> Search the list archives at: http://markmail.org/search/?q=vtkusers
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers
vtkusers Info Page - Kitware<http://public.kitware.com/mailman/listinfo/vtkusers>
To see the collection of prior postings to the list, visit the vtkusers Archives. Using vtkusers: To post a message to all the list members, send ...

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20170210/3e9118c1/attachment.html>

More information about the vtkusers mailing list