[vtkusers] vtkTextActor align to center of text

David Lonie david.lonie at kitware.com
Thu Feb 9 12:35:35 EST 2017


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

HTH,
Dave

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
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> 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
>


More information about the vtkusers mailing list