[vtkusers] Issues with coordinate conversion, possible VTK bugs?

Bill Q bill.q.hdp at gmail.com
Fri May 19 12:02:40 EDT 2017


Ok, I might find the cause. I put some textActor at the lower left corner.
So when I convert the coordinates to world, the returned coordinates are
different from the ones if I take those textActor away.

I could simply take those textActors away. But it doesn't feel like a real
solution. Besides, I need to have those textActors there.

Why putting some textActors there would change the readings of the
coordinates conversion? Is there anything I can do?

Many thanks.


Bill

On Fri, May 19, 2017 at 11:20 PM, Bill Q <bill.q.hdp at gmail.com> wrote:

> Hello Everyone,
> I encountered a weird problem in coordinate conversion.
>
> In order to check the accuracy, I converted from display to world, and
> from world back to display. Using the following ways:
>
>
> *self.world_picker = vtk.vtkWorldPointPicker()*
>
> *def *display_to_world(self, pt):
>     self.world_picker.Pick(pt[0], pt[1], 0, self.ren)
>     picker_pt = self.world_picker.GetPickPosition()
>     picker_pt = (picker_pt[0], picker_pt[1], 0)
>     *return *picker_pt
>
> *def *world_to_display(self, pt):
>     *if *len(pt) == 3:
>         pt = pt + (1.0,)
>     *elif *len(pt) == 2:
>         pt = pt + (0.0, 1.0)
>     self.ren.SetWorldPoint(pt)
>     self.ren.WorldToDisplay()
>     pt = self.ren.GetDisplayPoint()
>     pt = (pt[0], pt[1])
>     *return *pt
>
> pt = [5, 5]
>
> world_pt = self. world_to_display(pt)
>
> display_pt = self. world_to_display(world_pt)
> In some cases, it's quite accurate, which means pt equals display_pt. But,
> in some cases, the result is simply wrong. For example, for (5, 5), after
> conversions back to display, the coordinate becomes (20.89, 20.89).
>
> Any ideas?
>
>
> Many thanks.
>
>
> Bill
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20170520/93c6c806/attachment.html>


More information about the vtkusers mailing list